[Interest] QDockWidgets and ambiguous QShortcuts

Sergio Martins iamsergio at gmail.com
Tue Jun 7 21:29:41 CEST 2016


On Sunday, 29 May 2016 10:21:36 WEST Felix morack wrote:
> Hi,
> 
> I'm facing the following problem with Shotcuts (QShortcut) and docking
> widgets (QDockWidget).
> 
> I have a custom widget that is contained in a QDockWidget, in its ctor I
> register some keyboard shortcuts. As long as I have only one docking widget
> of this type all is fine, but when I have two or more the
> QShortcut::activated signal is not fired. Instead, the
> QShortcut::activatedAmbigiuouslysignal is fired.
> 
> 
> I dont know why though - the Shortcut is not ambiguous. If I register an
> event filter or override the eventFIlter method in my widget the keypress
> event is delivered correctly - and only once. (Ironically because of this
> my application works just fine if I connect both the actiavted and the
> actiavedAmbiguously signals to my slot...)
> 
> 
> Might this be a bug or a shortcoming in the QDockWidget subsystem?
> 
> 
> What has me baffled is that Qt's widgets (e.g. QLineEdit) have no problems
> with their keyboard shortcuts (copy, paste, etc.).
> 
> 
> regards
> 
> p.s. The same problem exists if I create a QAction with a Shortcut and add
> it to my widgte with addAction().


Hi,

Which shortcut context are you using and which widget is the QShortcut
parent ?


Regards,
Sérgio Martins




More information about the Interest mailing list