How do I mange QGraphicsScene's items position? Everytime I add a new item on my scene it gets centralized.Why does it do that?
How do I mange QGraphicsScene's items position? Everytime I add a new item on my scene it gets centralized.Why does it do that?
use QGraphicsItem::setPos()The item must be positioned anywhere, but that's no problem where since you have to arrange the items in the screen by yourself using the above mentioned function.Everytime I add a new item on my scene it gets centralized.Why does it do that?
This is how I'm adding the pixmap:
How do I set its position if there was no name given to the QGraphicsPixmapItem?Qt Code:
To copy to clipboard, switch view to plain text mode
you have to save the item in a member pointer or other global pointer... ther are other ways like findItem but that would be unecessary slow
you can rewrite this in following way:Qt Code:
item->setPos(100, 100); scene->addItem(item);To copy to clipboard, switch view to plain text mode
Wont things mess up if I continually call a function with
?Qt Code:
item->setPos(100, 100); scene->addItem(item);To copy to clipboard, switch view to plain text mode
Yes of course, but as said, you have to take care yourself for the arrangement of the items in the scene. (Or you could use QGraphicsLinearLayout)
Does QGraphicsLinearLayout automatically arrange the QGraphicsScene items in rows? Like
If it does, how do I implement it? Do I just add the scenes items to a QGraphicLinear layout? Does it also modify the height and width of the item if requested?Qt Code:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0To copy to clipboard, switch view to plain text mode
Bookmarks