[PyQt] Easy way to save the text of all QlineEdit widgets?

Paul Giannaros ceruleanblaze at gmail.com
Mon Sep 17 16:25:34 BST 2007

It's fairly easy but just how trivial it will be will depend on your
set up. Are all the QLineEdits on one widget? If so, some code a bit
like the following could work:

for widget in theParentWidget.children():
    if isinstance(widget, QLineEdit):
        myDictionary[widget.objectName()] = widget.text()

Otherwise you'll want to traverse the tree of QObjects started from
your dialog looking for QLineEdits.

On 17/09/2007, John Wheez <john at atomfx.com> wrote:
> Is there a function in pyQt which will iterate over the existing
> QlineEdit
> widgets and make a list/dictionary with the widget name and it's
> current text?
> Thanks for any input.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list