Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Creating Custom Widgets
StabbAmonte last edited by
I am looking into the custom widget functionality of the QT Designer. I want to create a custom widget with a combo box, tool button, label and a few other widgets. Is it possible to create this custom widget within the designer and then create the plug in for it show it shows up as a custom widget? All the examples I find are creating a widget from scratch or inheriting and modifying a single widget. I would like this widget to be a collection of existing QT widgets and create/edit it within the QT designer.
Any help is appreciated.
The examples are just showing with one widget. but there is nothing different if that
Widget creates internal widgets and insert into itself via a layout. One widget can be parent
of as many other widgets you like. Sort of a composite widget.
Note that if you are on windows, you must use Visual Studio to create such plugin as Creator
is compiled with it and to load the plugins, it must be same compiler.
But do you need a full blown plugin ?
Its possible to create a UI file (widget as parent)
where you place the wanted controls. (lets call it MyWid)
You can then on any other screen, place a widget as place holder and then use the promote feature to make it turn into MyWid when you run the program.
That is sort of a composite widget but of cause all properties will be the same as
for the master MyWid and only via code, can you make properties
different for each screen.
Andy314 last edited by Andy314
You can take a QFrame as base widget and design it as usual with the form-designer and put subwidgets in it.
Then you can promote this class or you can make a custom designer pluging for it. This work straight forward.