amol01
amol01

Reputation: 1863

Is it possible to save the gui/widgets created by code at run time?

I would like to save the gui/widgets that my code will create. So let say my code creates:

   QDialog *mywidget = new QDialog;
   miwidget->addwidget(/some widgtes/);
   mywidget->show();

What I want is, let say I have save action in menu/toolbar, by calling the action, I would like to save it above QDialog in some location.

And another thing, is it possible to save as Qdesigner .ui file, so I can further load with QFormloader or QGuiloader?

Any help appreciated.

Upvotes: 2

Views: 578

Answers (2)

ekhumoro
ekhumoro

Reputation: 120678

The QAbstractFormBuilder class has a save function that can save widgets to a .ui file.

Upvotes: 1

evilruff
evilruff

Reputation: 4085

In theory answer is YES. If you have a look into .ui file you will see that it's just an XML file with quite straight forward syntax, containing all children objects with properties etc.

So I don't see any problems to traverse child tree and generate file which will be accepted by UI designer or which you can use later on to load form dynamically through FormFactory.

Upvotes: 0

Related Questions