Bo Thorsen wrote:
On torsdag den 13. September 2007, Chris Portka wrote:
Is there a way for me to create a QGraphicsItem that doesn't change size
depending on the zoom resolution of the QGraphicsView? I want a
QGraphicsItem to be the same size no matter what the scaling matrix is.
I can do this manually whenever I change the scaling matrix of the
QGraphicsView, but this is painfuly slow - especially since I could
possibly be displaying > 100,000 objects. This seems like a common
enough feature that Qt should support it, but I can't find a way to do
it. Any help is greatly appreciated,
Qt 4.3 has this:
That should do the trick.
Ah yes, I did not realize this had been implemented in Qt 4.3. This
definitely works, keeping the objects the same pixel size no matter what
the zoom resolution. However, now the positions for the objects are
off. This is caused by the fact that all QGraphicsItem positions are
for the upper left corner of the object - not the center of the object.
Therefore, when the zoom resolution changes, the pixel size does not
change but the size of the item relative to the scene changes, which
affects the position of the item since it's position is in scene
coordinates. This makes the object's position on the scene incorrect.
Now, it seems that I would have to reposition all the items every time
the scaling matrix changes. This is just as bad as having to resize all
the items. Is there a way to give the position of the absolute center
of a QGraphicsItem, regardless of its size? This would solve my
problem, but I can't seem to find a way of setting the position of an
item to be anything but the upper left corner of the item. Any help is
greatly appreciated - thanks,
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/