  A Q-manifold is a graded manifold endowed with a vector field of degree one
squaring to zero. We consider the notion of a Q-bundle, that is, a fiber bundle
in the category of Q-manifolds. To each homotopy class of ``gauge fields''
(sections in the category of graded manifolds) and each cohomology class of a
certain subcomplex of forms on the fiber we associate a cohomology class on the
base. Any principal bundle yielding canonically a Q-bundle, this construction
generalizes Chern-Weil classes. Novel examples include cohomology classes that
are locally the de Rham differential of the integrands of topological sigma
models obtained by the AKSZ-formalism in arbitrary dimensions. For Hamiltonian
Poisson fibrations one obtains a characteristic 3-class in this manner. We also
relate to equivariant cohomology and Lecomte's characteristic classes of exact
sequences of Lie algebras.
