PDA

View Full Version : QGraphicsGridLayout Broken



oberlus
14th March 2010, 13:06
Hi

I have an application that uses a QGraphcsiGridLayout in a QGraphicsScene/View that works on 4.4.3 but does not on 4.6.1.

I've crafted a minimal copy to reproduce it. It subclasses the QGraphicsLayoutItem and QGraphicsEllipse classes to create a graphics object that can be added to the layout.

On 4.4.3 I get the grid of ellipsis displaying ok. When I compile and run under 4.6.1 the screen is shown blank.

Can anyone tell me what's wrong?

Here is the .pro file:


TEMPLATE = app
TARGET = GraphicsLayoutTest
DESTDIR = ../Release
CONFIG += release
INCLUDEPATH += ./GeneratedFiles \
./GeneratedFiles/Release \
.
DEPENDPATH += .
MOC_DIR += ./GeneratedFiles/release
OBJECTS_DIR += release
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles

#Include file(s)
include(GraphicsLayoutTest.pri)

and .pri file:


#Header files
HEADERS += ./ellipseitem.h \
./graphicslayouttest.h

#Source files
SOURCES += ./ellipseitem.cpp \
./graphicslayouttest.cpp \
./main.cpp

#Forms
FORMS += ./graphicslayouttest.ui

#Resource file(s)
RESOURCES += ./graphicslayouttest.qrc


Thanks, Paul

oberlus
27th August 2010, 10:32
The problem was solved by changing the implementation of EllipseItem::setGeometry to call the QgraphicsLayoutItem base class setGeometry method before setRect():

QgraphicsLayoutItem::setGeometry(rect); // Call the base class first
setRect(rect);

Hope this helps someone...