[PyKDE] queryList is returning incorrect type for QTables

Baz Walter bazwal at ftml.net
Thu Nov 10 02:05:00 GMT 2005


On Wednesday 09 Nov 2005 22:40, Jason Zwolak wrote:
> The attached code querys a QWidget for children with the name table3.
> There is a widget with the name table3 and it is of type QTable.  The
> returned widget, however, has the type QScrollView.  As a result I
> cannot call QTable methods on the QTable object.  (run the code and an
> AttributeError will be generated)
>
> How can I get a correctly typed QTable object from my widgets generated
> by my ui file?
>
> I am using PyQt 3.15 from (the development repository of) Fedora Core 4
> and Python 2.4.1 and Qt version 3.3.4.
>
> Any help will be appreciated, thanks,
>
> Jason

This can be fixed by explicitly importing QTable. Try adding the following to 
your list of imports:

	from qttable import QTable

BTW, do you really need to use QWidgetFactory? If not, try using pyuic to 
convert the your ui file to a python module. Then import the Form1 class from 
this module and create an instance of it to set as the mainWidget. The table 
can then be accessed as self.main.table3 (or qApp.mainWidget().table3) in 
your example.

HTH
-- 
Baz Walter




More information about the PyQt mailing list