Item Selection in graphicsScene !
-
Hi all,
What is the method to select a group of graphicsItems in order to move them together in a graphicsScene ?
Thanks in advance. :) -
"QGraphicsItemGroup":http://qt-project.org/doc/qt-4.8/qgraphicsitemgroup.html
bq. group several smaller items into one big item in order to simplify moving and copying of items.
-
Hello,
If I have understand your idea, I have to add every item that belong to the selection rectangle area to a QGraphicsItemGroup object ? -
Yes :-)
-
I think you know about "QGraphicsScene::selectedItems":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#selectedItems method.
-
Yes, I know QGraphicsScene::selectedItems ? Why ? :)
In my case it's better to use setSelectionArea(), to set the path to my Selection rectangle ! Are you agree cincirin or there is another more simple method ?
thanks !
-
Note that setSelectionArea is obsolete.
[quote author="issam" date="1362398519"]Yes, I know QGraphicsScene::selectedItems ? Why ? :)
[/quote]Because you can simply add all selected items in QGraphicsItemGroup.
-
Call "QGraphicsScene::createItemGroup":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#createItemGroup with the result from selectedItems()
-
bq. Note that setSelectionArea is obsolete.
So, what is the best method to select many items at once ?
-
Sorry for confusion, so "setSelectionArea with QTransform":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#setSelectionArea are safely to use, but "these setSelectionArea methods":http://qt-project.org/doc/qt-4.8/qgraphicsscene-obsolete.html#setSelectionArea-2 are obsolete
-
Hi, I understand now.
I still use use Qt 4.8.1. This old version uses the obsolete function setSelection(), that you mean !