Hello fellow Qt programmers.
I would like to see if you have any ideas to my problem.
Here we go. I have a library with custom widgets which I use in my project. I use these widgets in a QGraphicsScene. I add them with the use of QGraphicsProxyWidget. Now to get to the problem. After I have added these widgets i want to access the functions that the initial widget has. ex. my widget has a setValue function.
And i want to access its functions when ex. you right click on the item in the scene, scene returns the QGraphicsItem with the use of function itemAt. Now I want to cast this QGraphicsItem to the original widget. But this is a problem if I have 20 widgets and I dont know what to cast it to.
What I am looking for is something similar to the type() functions in QGraphicsItem but for my widget. So I can set a specific type for my widget and i can access it in someway to compare with the QGraphicsItem I get returned.
Any ideas would be helpful for mapping this in a good way. I have thought of QHash and storing the pointer of the inital widget together the a string key which i also pass for the QGraphicsProxyWidget as data. But this gets messy when you have 20 diffrent widgets.
Bookmarks