-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.6.2, 4.6.3, 4.7.2
-
None
-
Reproduced the fault on 3 operating systems and 3 versions of QT...
- Windows XP SP3. MS Visual Studio 2008. QT 4.6.3
- Windows Mobile 6/6.1 Professional. MS Visual Studio 2008. QT 4.7.2
- Linux RedHat 4.
exampleApp> uname -a
Linux lars00503 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux
exampleApp> gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
exampleApp> qmake -v
QMake version 2.01a
Using Qt version 4.6.2 in /usr/local/Trolltech/Qt-4.6.2/libReproduced the fault on 3 operating systems and 3 versions of QT... - Windows XP SP3. MS Visual Studio 2008. QT 4.6.3 - Windows Mobile 6/6.1 Professional. MS Visual Studio 2008. QT 4.7.2 - Linux RedHat 4. exampleApp> uname -a Linux lars00503 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux exampleApp> gcc -v Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux Thread model: posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-3) exampleApp> qmake -v QMake version 2.01a Using Qt version 4.6.2 in /usr/local/Trolltech/Qt-4.6.2/lib
If you add a QGraphicsPixmapItem with the QGraphicsItem::ItemIgnoresTransformations flag set, it will cause the parent QGraphicsScene's sceneRect to extend to 0,0 even when the pixmap item is no where near (0,0) and no other item is located near 0,0.
The QGraphicScene sceneRect is failing to take in to account the position of the pixmap relative to the graphicsScene when uniting the sceneRect with the pixmapItem.boundingRect().
The attached sample app demonstrates this problem. Click the "add pixmap" button to add a QGraphicsPixmapItem to the QGraphicsScene. All items on the QGraphicsScene are located above 1000,1000 (including the pixmap). When the pixmap is added the sceneRect extends to 0,0 causing all the items to disappear off screen. MainWindow.cpp contains the code that populates the graphics scene and the addPixmap slot.
A simple workaround is to call graphicsSene.setSceneRect( graphicsScene.sceneRect() ) - see the code inside the "BOUNDINGRECT_WORKAROUND" ifdefs.
The same problem can also be reproduced with other QGraphicsItems when the ItemIgnoresTransformations flag is set. The MainWindow::addEllipse function demonstrates this if QGraphicsEllipseItem::setRect is used to create an ellipse at 0,0 which is then moved by a call to setPos. SetPos is called before the item is added to the parent scene.