[PyQt] explanatory label in a not uniformly scaled QGraphicsView
TP
wingusr at gmail.com
Thu Feb 10 10:37:20 GMT 2011
On Wed, Feb 9, 2011 at 1:09 PM, Hans-Peter Jansen <hpj at urpla.net> wrote:
> On Wednesday 09 February 2011, 15:06:24 KONTRA, Gergely wrote:
>> Hi all!
>>
>> Is there a way to place a text on a QGraphicsView, which always looks
>> the same size (say 10px) on screen, regardless of the scaling applied
>> to the View?
>
> Gergo, this is exactly a case, where studying the Qt source is most
> helpful. Probably you can just subclass and reimplement the object of
> your liking, that doesn't apply the scaling in the paint event...
>
> Pete
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
Did you try http://doc.qt.nokia.com/latest/qgraphicsitem.html#setFlag
with http://doc.qt.nokia.com/latest/qgraphicsitem.html#GraphicsItemFlag-enum
set to QGraphicsItem::ItemIgnoresTransformation:
"The item ignores inherited transformations (i.e., its position is
still anchored to its parent, but the parent or view rotation, zoom or
shear transformations are ignored). This flag is useful for keeping
text label items horizontal and unscaled, so they will still be
readable if the view is transformed. When set, the item's view
geometry and scene geometry will be maintained separately. You must
call deviceTransform() to map coordinates and detect collisions in the
view. By default, this flag is disabled. This flag was introduced in
Qt 4.3. Note: With this flag set you can still scale the item itself,
and that scale transformation will influence the item's children."
-- TP
More information about the PyQt
mailing list