Get the selected item key outside Madcad View ... #25
-
Hi, I just integrated the View into PyQt5 app and then I need to get back the "key" of the selected shape into my app. I analyzed rendering.py and I don't see how to connect/intercept the inputEvent to get back the key (key = self.itemat(pos) ....) thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello ! Glad you reached out to the code and understood its architecture :)
You can alternatively override the view widget's method Don't hesitate to tell me if you need more details |
Beta Was this translation helpful? Give feedback.
Hello !
Glad you reached out to the code and understood its architecture :)
The way to receive events for an object in the scene (a
rendering.Display
instance) is to override itscontrol
methodYou can take a look at the way its used in
kinematic.Solid.display
kinematic.Kinemanip
Display.control(view, key, sub, event)
works just like a regular Qt event handler method, it receives an event and can choose to accept or ignore it. If it is ignored, the event will be sent over to the display's eventual children in the scene (corresponding to a sub-key), until it is acceptedYou can alternatively override the view widget's method
View.inputEvent
to set a global behavior not specific to aDisplay