Thank you. The thing is that I have many buttons in a QButtonGroup and I want call a function function() on only one of them when I right-click it. Do you know how to do it?
Thank you. The thing is that I have many buttons in a QButtonGroup and I want call a function function() on only one of them when I right-click it. Do you know how to do it?
You have two options:
1. Subcalss QPushButton, override the mousePressEvent() or mouseReleaseEvent() based on your needs, and emit a signal from there.
You can then connect that signal to any slot of any other QObject class.
2. Use an event filter in the parent class of the buttons, catch the mousePressEvent (ore released event) and emit a signal form there, which again, you can connect to any other known instance of any other QObject class.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Bookmarks