[PySide] QShortcut suppressed by parent widget?

Frank Rueter | OHUfx frank at ohufx.com
Tue Jul 12 02:23:44 CEST 2016


Ah yes, after Tibold's example using actions and your explanation it's 
perfectly clear what is happening, thanks.
When I use the enter/leave events for enabling/disabling the action 
respectively it all works as expected.

Thanks guys!

frank


On 07/12/2016 02:05 AM, Baz Walter wrote:
> On 11/07/16 07:30, Frank Rueter | OHUfx wrote:
>> Hi all,
>>
>> below is some test code that shows the problem I'm having, where a 
>> shortcut
>> assigned to a child widget will not be triggered once it's part of 
>> the main widget.
>> It works if the widget is called by itself but not when it's part of 
>> a parent
>> widget.
>>
>> I have been searching the internet for an solution but haven't had 
>> any luck.
>>
>> Does anybody know what I'm doing wrong?
>
> The shortcuts are ambiguous, since you assign the key "i" to each one. 
> If you assign a unique key to each shortcut, your example will work as 
> expected.
>
> When shortcuts conflict in this way, the 
> QShortcut.activatedAmbiguously signal is emitted, rather than 
> QShortcut.activated:
>
>     http://doc.qt.io/qt-4.8/qshortcut.html#activatedAmbiguously
>
> -- 
> Regards
> Baz Walter
>




More information about the PySide mailing list