Add legend double-click and legend sample click signals.#3111
Conversation
* can be used to pop up a legend font/style dialog, for example add legend sample click signal * can be used to detect which plot data items have been made visible or invisible externally
|
Thanks for the PR @kevinanewman ! I mentioned the issue with the method that I don't think we need; the other issue I have is with what the signals are carrying.
|
| self.autoAnchor(self.pos() + dpos) | ||
|
|
||
| def mouseDoubleClickEvent(self, ev): | ||
| self.sigDoubleClicked.emit(self, ev) |
There was a problem hiding this comment.
We should probably pass the event to the superclass.
super().mouseDoubleClickEvent(ev)
self.sigDoubleClicked.emit(self, ev)There was a problem hiding this comment.
In my case I wanted the app get a notification, I'm not making a new class or subclass (or multiple layers of them since the legend is multiple objects deep in the code).
If you try out the Legend.py example I updated you'll see what I mean. I use the double click signal to pop up a dialog box to change the legend font size. Of course other style changes could be made available as well.
|
Sorry for the delay, this LGTM. Thanks for the PR @kevinanewman |
) * add legend double click signal * can be used to pop up a legend font/style dialog, for example add legend sample click signal * can be used to detect which plot data items have been made visible or invisible externally * update Legend.py to illustrate new signal use cases * use fully scoped enums! * simplification
An application may need/want to know which plot data items are visible, the sigSampleClicked signal can be used for this purpose.
An application may want to resize the legend text after a legend has been created. The sigDoubleClicked signal can be used for this.
The example Legend.py has been updated to illustrate example use cases.
Tested against PyQt6 and PySide6.
Thank you for you consideration,
Kevin