You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, June 14th 2012, 9:39am

context menu, multi selection and QAction.

Dear all,

I'm writting an application in c++ using Qt.

I have a QTreeWidget which can display base nodes inherited QTreeWidgetItem.
Each items correspond to a kernel object.
Each item have a virtual pure method to return available actions. ( add a certain type of child, edit properties of the kernel object... )

I want to enable multi selection in QTreeWidget and show a contextual Menu containing actions of each items in selection, but just one time.

for example, if my selection is :

Object0 typeA (action0, action1, ... )
Object1 typeA (action0, action1, ... )
Object2 typeA (action0, action1, ... )

I want to display available actions
(action0, action1, ... ) if I click action0 i want to trigger the action0 for Object0, Object1, Object2.

I've writen a class to factorize action using objectName. So it works but because of the kernel undo framework, In the undo stack action0 for object0 is added , action0 for object1 is added , action0 for object2 is added. ( I just want 1 action in the UndoStack ).

Is it a simple way to do that with Qt?

Thanks

Similar threads