[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] =?utf-8?q?QPushbutton_connect=28no-arg=29_signal_variant_i?=
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2014-09-07 16:45:10
Message-ID: 34616d2a4261b1bf8fcd52ebc59eb6a6 () www ! riverbankcomputing ! com
[Download RAW message or body]

On 06/09/2014 7:03 pm, David Cortesi wrote:
> Python 3.3. Under version 5.2 the program below prints,
> 
>> PyQt 5.2 Qt 5.2.0
>> slot got ()  # <-- when button is clicked
> 
> Under version 5.3, it prints
> 
>> PyQt 5.3 Qt 5.3.0
>> 'there is no matching overloaded signal'
> 
> So it appears that the syntax "clicked[()].connect(slot)" to select the
> no-arg signal, that worked in 5.2, somehow does not in 5.3. Apologies 
> if
> this is fixed in 5.3.1, however I don't see anything relevant in the 
> 5.3.1
> changelog.
> 
> Here is the quite simple test case:
> 
>> '''
>> Test of QPushButton clicked() signal
>> ''
>> from PyQt5.QtCore import PYQT_VERSION_STR
>> from PyQt5.QtCore import QT_VERSION_STR
>> print('PyQt',PYQT_VERSION_STR,'Qt',QT_VERSION_STR)
>> 
>> from PyQt5.QtWidgets import QApplication,QWidget,QPushButton
>> def slot(*args):
>>     print('slot got',args)
>> the_app = QApplication([])
>> widg = QWidget()
>> pb = QPushButton(widg)
>> try:
>>     pb.clicked[()].connect(slot)
>> except KeyError as k:
>>     print(k)
>>     exit()
>> widg.show()
>> the_app.exec_()

This is intended and documented - but I forgot to document it as a 
potential incompatibility in PyQt v5.3.

The original design was broken and I felt it was a safe change because I 
can't see why you would ever need to do this. Just using 
clicked.connect() should work for all versions.

Happy to discuss further if you disagree.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic