Repopulate QT Widget based on XML File

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
wildspidee
Full Member
Posts: 84
Joined: Sat Nov 03, 2012 2:00 am

Repopulate QT Widget based on XML File

Post by wildspidee » Mon Apr 13, 2015 3:21 pm

Andrew,

The add-on that I created is working well. There is one thing I was not able to accomplish that needs to be done. Right now, the only data that is opened in the QT widget dialog is the last data set entered. I would like the ability to select any prior XML file to populate the widget for changes and a subsequent save.

Are there any examples within the program that do this? The code is currently using the combination createWidget() / restoreState(). I would need code after the creation to open the selected XML and populate the UI dialog with it.

Any help would be appreciated. Thank you,

Lori

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Repopulate QT Widget based on XML File

Post by andrew » Mon Apr 13, 2015 3:30 pm

saveState / restoreState uses the configuration file to save the contents of a widget.
To read the data from an XML file (e.g. to fill in the GUI components accordingly), you'd have to use QXmlSimpleReader.

wildspidee
Full Member
Posts: 84
Joined: Sat Nov 03, 2012 2:00 am

Re: Repopulate QT Widget based on XML File

Post by wildspidee » Mon Apr 13, 2015 3:37 pm

Thank you.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”