[PySide] QShortcut suppressed by parent widget?

Baz Walter bazwal at gmail.com
Mon Jul 11 16:05:12 CEST 2016


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