PDA

View Full Version : Items in QGraphics View not starting from the top.



penny
31st March 2011, 12:19
I have a QGraphicsView. I have plotted a series of text in it. However the text starts from the middle of the view and not from the top. Surprisingly, when i say open new file in my application, the text comes properly in place for the newly opened file. It is just the first time, that the text comes misaligned.
If i force the text to align on top by using steAlignment(Qt::AlignTop) then it comes aligned on top, but the vertical scroll bar gets disabled.

wysota
31st March 2011, 12:23
What do you want to scroll if your scene is smaller than your view?

penny
1st April 2011, 11:10
The scene is not smaller than the view.. The scene is quite large.

wysota
1st April 2011, 13:10
Then alignment wouldn't matter. If it matters then either the scene is smaller than the view or the view is zoomed out so much that the effective scene size is smaller than the view. If I were to guess, I'd say your scene rect is messed up by something.