Re: How to communicate btw QGraphicsScene and QTreeWidget
Originally Posted by Cal
Hey,
i wanna know whats the best way to communicate between a QGraphicScene and a QTreeWidget.
I have a QTreeWidget containing some QTreeWidgetItems and a QGraphicsView containing some QGraphicsItems, representing the positions of the items shown in the QTreeWidget.
What i want to do: if you select an item in the TreeView, the corresponding GraphicsItem in the GraphicsView should be selected. and the other way around: select an item in the graphics view and the corresponding QTreeWidgetItem should be highlighted.
I created a class which inherits both QGraphicItem and QTreeWidgetItem, but i couldnt figure out how to connect the view and the treewidget properly.
Maybe you have some ideas?
SIGNAL AND SLOT.
As Qt always says, signals and slots are used for interobject communication.
And here your graphics item and tree widgt are just 2 objects wanna talk to each other.
Bookmarks