View Full Version : QGraphicsItem disappeare during rotation around Qt::XAxis

18th January 2009, 10:40
I can't find the reason, why my object disappearing during transformation around the XAxis.
I am showing here the short code which better expain what I mean.
When I use QTransform on the scene and rotate the view, then if i use high angle the QGraphicsRectItem disappeare.
Or if I make the view window height bigger, which anybody who would help me can try in this small app.

#include <QApplication>
#include <QGraphicsView>

int main(int argc, char **argv)
QApplication app(argc, argv);

QGraphicsScene scene;
scene.addRect(QRectF(0,0,100,100), QPen(), QBrush(QColor(Qt::red)));
QGraphicsView view(&scene);

QTransform transform;
transform.rotate(80, Qt::XAxis);

return app.exec();

18th January 2009, 10:46
I can see the item just fine. Bear in mind that graphics items are flat, if you rotate them 90 deg. they will disappear because their z size is 0.

18th January 2009, 12:18
did you try to change window size? if I make it vertically bigger the item disappear and again appear when i make the window smaller.
If you tried it and you still can see it then the problem will be somewhere else, but I have no idea where. I was trying on the different comps with kubuntu and and also on windows. The problem was on all of them.

19th January 2009, 03:07
Hi, you should know what really you want to do. If you only want to rotate the rect, just use QGraphicsItem::rotate(). The transform will rotate the whole coordinate.

19th January 2009, 07:44
the code above is just simple example to demonstrate what I mean. I am doing chessboard, so there should be option to zoomin and out and to rotate it. But then is coming the problem which I described above.


20th January 2009, 09:13
so looks like it was a bug, i have tried on qt 4.5 and the transformation is fine