Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening combo box screens key events #3654

Open
PhysSong opened this issue Jun 22, 2017 · 2 comments
Open

Opening combo box screens key events #3654

PhysSong opened this issue Jun 22, 2017 · 2 comments

Comments

@PhysSong
Copy link
Member

How to reproduce:

  • Add a new Monstro instrument track
  • Click small triangle button next to sine wave pixmap
  • Press any key shortcut, it won't work.

Reason: ComboBox uses QMenu to show contents, and it screens key events.

Is there anyone who knows how to fix this?

@tresf
Copy link
Member

tresf commented Jul 14, 2017

@PhysSong I recommend looking into the keyPressEvent on the QMenu in general however this drop-down is actually a custom made ComboBox (not a QMenu, not a QComboBox I don't think).

I recommend binding a keyPressEvent that propagates to the parent widget. It seems to be trapping the keystrokes inside the widget.

For starters, I'd mimic the way we capture mousePressEvent and once you have your events being captured, decide how to proccess them.

@tresf
Copy link
Member

tresf commented Jul 14, 2017

Ok, you're right, it uses a QMenu under the covers. Since AFAIK there's no externally exposed API method to override QMenu's keypress events, you will likely need to subclass the menu to grab the proper virtual function. Seems overkill if coming from a non-C++ language, but I think it's needed. I had a similar conversation with jasp00 about the need to subclass for a single function this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants