[PyQt] List widgets in a widget

starglider develop starglider.dev at gmail.com
Mon Sep 6 22:03:00 BST 2010


Hi,
I have a TabWidget dinamicly populated with widgtes(QLabel and QLineEdit),
and I need to know all the widgets by name in a way I can get their values.
This is for a database application, and I want to get the name of the
widgets that
are the name of the fields in the database.

the widget if populated like this:

field2Display = [[1, 'Titulo', 'pu_title'], [3, 'Autor', 'pu_author'],
[2,'Titulo Original', 'pu_title_original']]
        for n in field2Display:
            dumLayout = QHBoxLayout()
            self.dum = QLineEdit()
            self.dum.setObjectName(n[2])
            label = QLabel( n[1])
            dumLayout.addWidget(label)
            dumLayout.addWidget(self.dum)


            tab1Layout.addLayout(dumLayout)

the first element is a index, the second is the namoe of the label, the
third is the name os the widget and the name of the field.

Or

is there any other way o achieve this?

Thank you in advance for your help.

Zorze
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100906/43037d54/attachment-0001.html>


More information about the PyQt mailing list