PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1062 - Unable to connect to triggered[bool] signal in QAction constructor with checkable=True
: Unable to connect to triggered[bool] signal in QAction constructor with check...
Status: RESOLVED WONTFIX
Product: PySide
Classification: Unclassified
Component: QtGui
: HEAD
: PC Other
: P2 normal
Assigned To: Paulo Alcantara
:
:
:
  Show dependency treegraph
 
Reported: 2011-11-17 11:55 EET by Vladimir Rutsky
Modified: 2011-12-13 20:28 EET (History)
10 users (show)

See Also:


Attachments
example of different cases of handling triggered signal (1.84 KB, text/x-python)
2011-11-17 11:55 EET, Vladimir Rutsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Rutsky 2011-11-17 11:55:08 EET
Created attachment 450 [details]
example of different cases of handling triggered signal

I'm trying to handle triggered[bool] signal by specifying slot in QAction
constructor:

def handler(checked):
   print checked
action = QtGui.QAction(None, triggered=handler, checkable=True)

But action always calls handler as "handler()", not "handler(bool)".

I think when "checkable=True" QAction should connect "triggered=handler"
handler to "triggered[bool]" signal, not "triggered".

Please see attached example of possible cases and differences in their work in
PySide and PyQt.

As workaround I'm attaching to triggered[bool] signal outside of constructor:

action = QtGui.QAction(None, checkable=True)
action.triggered[bool].connect(handler)
Comment 1 Hugo Parente Lima 2011-12-09 21:03:31 EET
Hi;

Only signals without arguments are accepted on the "Connect on Constructor"
syntax by PySide, QAction has two signals called "triggered", with and without
an argument, so PySide always get the signal without argument when using this
syntax.

Btw, this syntax is very error prone and not clear, PySide have it just to be a
bit more compatible with PyQt, so I strong advice anyone to not connect signals
and slots using constructor argument nether assign property values.

The wiki page was updated[1].

[1] http://developer.qt.nokia.com/wiki/Differences_Between_PySide_and_PyQt
Comment 2 Vladimir Rutsky 2011-12-13 20:28:45 EET
Thanks for explanation.