[Qt-interest] Aligning QBrush texture
Josh
jnfo-c at grauman.com
Wed Sep 1 19:18:16 CEST 2010
Hello all,
In painting a widget (in it's paint event) I draw a rectangle in the
middle of the widget. The rectrangle has a QBrush with a pixmap background
that is small and so tiles in the rectangle. I would like to align the
tiling of the pixmap so that the top-left corner of the pixmap tiles to
the top-left corner of the rectangle (and then tiles throughout the
rectangle). Currently, the alignment is set so that the pixmap's top-left
corner is aligned to the top-left corner of the widget (not the
rectangle). Any hints on how to do this? I was thinking about translating
the painter, but I think this would make my rectangle draw at a a
different location.
QBrush brush(pixmap);
painter.setBrush(brush);
painter.setPen(Qt::NoPen);
painter.drawRect(rect);
Thanks!
Josh
More information about the Qt-interest-old
mailing list