Search code examples
qtqt-creatorqt-designer

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.


Solution

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