Qt-interest Archive, December 2006
QPainter line width with scaling
Message 1 in thread
Hello,
I'm working on a small program for viewing maps/graphing, and I'm looking
for a way to draw lines at a constant width regardless of the transformation
system.
From the docs http://doc.trolltech.com/4.1/qt4-arthur.html
"In Qt 3, pens and brushes weren't affected by the painter's transformation
matrix. For example, if you drew a rectangle with a pen width of 1 using a
scaled painter, the resulting line width would still be 1. This made it
difficult to implement features such as zooming and high-resolution
printing.
In Qt 4, pens and brushes honor the painter's transformation matrix."
I'm interested in behaviour like the Qt 3 behaviour, is such a thing
possible?
Thanks,
Oliver Batchelor
Message 2 in thread
Oliver Batchelor wrote:
> I'm working on a small program for viewing maps/graphing, and I'm
> looking for a way to draw lines at a constant width regardless of the
> transformation system.
Would it help to know that a pen width of 0 is always drawn as a single
pixel, regardless of the painter transformation system? You may have
already known that...
--Dave
--
[ signature omitted ]
Message 3 in thread
Dave Smith wrote:
> Oliver Batchelor wrote:
>
>> I'm working on a small program for viewing maps/graphing, and I'm
>> looking for a way to draw lines at a constant width regardless of the
>> transformation system.
>
>
> Would it help to know that a pen width of 0 is always drawn as a single
> pixel, regardless of the painter transformation system? You may have
> already known that...
In addition to that we introduced QPen::setCosmetic() in Qt 4.3,
available in snapshots. Setting this to true will make it so that the
pen is drawn at its given width, regardless of the QPainter transformation.
best regards,
Gunnar
--
[ signature omitted ]
Message 4 in thread
Hi,
Yes, I'd descovered the 0 width pen - but that makes for fairly ugly looking
lines. The cosmetic pen width would be very useful. For now I'll just use
the QPainter untransformed and do the transformations myself.
Thanks all,
Oliver Batchelor
On 12/6/06, Gunnar Sletta <gunnar@xxxxxxxxxxxxx> wrote:
>
> Dave Smith wrote:
> > Oliver Batchelor wrote:
> >
> >> I'm working on a small program for viewing maps/graphing, and I'm
> >> looking for a way to draw lines at a constant width regardless of the
> >> transformation system.
> >
> >
> > Would it help to know that a pen width of 0 is always drawn as a single
> > pixel, regardless of the painter transformation system? You may have
> > already known that...
>
> In addition to that we introduced QPen::setCosmetic() in Qt 4.3,
> available in snapshots. Setting this to true will make it so that the
> pen is drawn at its given width, regardless of the QPainter
> transformation.
>
> best regards,
> Gunnar
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>