volkan kepoglu ha scritto:

Hi Phil,
I am trying to write a plugin for Qgis. The plugin will do
spatial data analysis. I am using PyQt4 in python 2.5.
In one form/dialog, there are several Qwidgets like
QLineEdit and QLabel. I want to get the list of
Qwidgets name, Qwidgets type (like QLineEdit, QLabel)
and Qwidgets default value (my_qlabel.text()) and assign
these values to python list. I mean that trying to get
a list like;

list_widgets_name = ["my_qlineEdit", "my_qlabel"]
list_widgets_type = ["QLineEdit", "QLabel"]
list_widgets_value = ["Hello world", "Thanks a lot"]
Could you please help me? Is there a qt-class having
the list of widgets in the form? or where to look?

You can simply add the widgets to a list. After that, you can retrieve the values, names or whatever you want, by ciclying over the list itself.

For example:

self.widgets = []

label1 = QLabel(self)
# other stuff...
self.widgets.append(label1)

line_edit1 = QLineEdit(self)
# other stuff...
self.widgets.append(line_edit1)

for widget in widgets:
   name = widget.objectName()

Simone
Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to