PDA

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



radek.z
18th January 2009, 10:40
Hi,
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);
view.show();

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

return app.exec();
}

wysota
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.

radek.z
18th January 2009, 12:18
Hi,
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.

angelhigh
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.

radek.z
19th January 2009, 07:44
Hi,
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.

Radek

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