  Since the parity-time-(PT-) symmetric quantum mechanics was put forward,
fundamental properties of some linear and nonlinear models with PT-symmetric
potentials have been investigated. However, previous studies of PT-symmetric
waves were limited to constant diffraction coefficients in the ambient medium.
Here we address effects of variable diffraction coefficient on the beam
dynamics in nonlinear media with generalized $\mathcal{PT}$-symmetric Scarf-II
potentials. The broken linear PT symmetry phase may enjoy a restoration with
the growing diffraction parameter. Continuous families of one- and
two-dimensional solitons are found to be stable. Particularly, some stable
solitons are analytically found. The existence range and propagation dynamics
of the solitons are identified. Transformation of the solitons by means of
adiabatically varying parameters, and collisions between solitons are studied
too. We also explore the evolution of constant-intensity waves in a model
combining the variable diffraction coefficient and complex potentials with
globally balanced gain and loss, which are more general than PT-symmetric ones,
but feature similar properties. Our results may suggest new experiments for
PT-symmetric nonlinear waves in nonlinear nonuniform optical media.
