0

I would like to create a custom main window for my application and I would like to integrate it with Qt Creator. When you create a new Qt Widgets Application you get the option of inheriting from QWidget, QMainWindow or QDialog. I would like to add my own widget there:

enter image description here

I would like my custom .ui form to be generated when I select my custom widget from the drop down list. Is this possible? If yes, how?

Or maybe it is possible to add a custom template widget to the Qt Designer Form dialog when creating a new form? I'm talking about this:

enter image description here

Regards!

Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140

1 Answers1

2

To integrate a custom widget with Qt Designer, you require a suitable description for the widget and an appropriate .pro file. It is documented here: http://qt-project.org/doc/qt-4.8/designer-creating-custom-widgets.html

ypnos
  • 50,202
  • 14
  • 95
  • 141
  • Does this also provide means to create custom widget templates? e.g. when you create a new form I'd like to be able to choose that custom widget – Jacob Krieg Sep 08 '14 at 12:26
  • It doesn't look like it to me. – ypnos Sep 08 '14 at 12:54
  • What do you mean by `It doesn't look like it to me`? – Jacob Krieg Sep 08 '14 at 13:53
  • I successfully created qt designer plug-ins and integrated them with qt designer but my goal is to create template forms(forms that appear under `templates\forms` or under `Widgets` in the second screenshot above). Is this possible? – Jacob Krieg Sep 08 '14 at 13:54
  • These templates were introduced with Qt 4.8 and since then somewhat forgotten. I don't know if a system exists to add custom ones as a user. However on a linux system, you find the file /usr/share/qtcreator/designer/templates.xml that contains these templates. You can add other .ui files in the XML. On other systems, check the appropriate installation paths. – ypnos Sep 08 '14 at 14:27
  • I tried adding my templates to `/usr/share/qtcreator/designer/templates.xml` and to `/usr/share/qtcreator/designer/templates` but unfortunately it doesn't work. Do you know any other place things could be changed in order to add new templates? – Jacob Krieg Sep 09 '14 at 13:40
  • No, that's all I know, but I don't see why it should not work if there is no error somewhere. – ypnos Sep 09 '14 at 19:30