[PyQt] Newbe needs help porting to (Py)Qt4

Phil Thompson phil at riverbankcomputing.co.uk
Tue Apr 3 17:12:09 BST 2007


On Tuesday 03 April 2007 4:40 pm, Lawrence Shafer wrote:
> Hello,
>
> My first post here, and also my first python app.
>
> I'm having trouble getting my Qt3 app wotking in Qt4. I have designed
> the UI in QT-Designer and ported it to Qt4 with uic3 -convert, and
> removed all Qt3 support widgets. When I run the .py it complains:
>
> Traceback (most recent call last):
>   File "testapp.py", line 100, in ?
>     app = HelloApplication(sys.argv)
>   File "testapp.py", line 20, in __init__
>     self.maindialog = TestAppUI(None)
>   File "testapp.py", line 31, in __init__
>     self._connectSlots()
>   File "testapp.py", line 42, in _connectSlots
>     self.connect(self.addbutton,SIGNAL("clicked()"),self._slotAddClicked)
> AttributeError: 'TestAppUI' object has no attribute 'connect'
>
> Is this a change in QT, or one of my mistakes?

A change in Qt. The class that is generated is no longer a widget - you supply 
that separately as an argument to the generated setupUi() method.

There are various programming styles you can use - see the "Using a Component 
in You Application" section of the Designer documentation.

Phil


More information about the PyQt mailing list