[Qt-creator] QtDesigner and custom widgets

Jakob Lettenbichler jakob.lettenbichler at artech.at
Fri Jun 10 15:48:49 CEST 2022


I kind of have a very specific case to deal with (Qt5, Widgets, QtDesigner in QtCreator):

I have a custom widget (A) in the QtDesigner in QtCreator that I can add, modify, and remove there, storing works as well.
It has its own QDesignerTaskMenuExtension, that allows to open an extra dialog, where a bunch of Q_PROPERTY entries are handled (works as well), and stored after dialog close.
That widget shall now get an option to dynamically create/remove helper widgets (B) that shall be stored as children of A.
These B widgets are custom widgets too, but are not part of the QtDesigner widget box, although they shall be stored in the ui file too (seems to be possible: https://doc.qt.io/qt-5/designer-creating-custom-widgets.html#notes-on-the-domxml-function).

In my dialog of A, where I modify the “normal” Q_PROPERTYs I now create these Bs, and want to add them as children of A in the ui file.
Although added as actual children of A (simply calling setParent, in gdb I see that they are registered correctly), I fail to store them in the ui file.
I get my formwindow and cursor to set/reset the properties, but that information never reaches the ui file.

I sincerely hope and appreciate that anyone here could give me some hints about my topic,
Many thanks in advance,


P.S.: as far as I understand the documentation, A is not a container in QtDesigner sense (https://doc.qt.io/qt-5/qdesignercustomwidgetinterface.html#isContainer), since that one is used for being able to use layouts and such.
Additionally it is not a custom container like https://doc.qt.io/qt-5/qdesignercontainerextension.html#addWidget, since these helper widgets are not pages, but represent dynamical sets of extra properties, that shall be added/removed as needed during design time. They have no paint events, but have other jobs to do.

FN 181686 k. HG Wien, UID-Nr. ATU 47056901, zertifiziert nach ISO 9001:2015 Nr. 04036/0
Der Inhalt dieser E-Mail ist vertraulich und ausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des Inhaltes dieser E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen und die E-Mail zu vernichten. Für Übermittlungsfehler oder sonstige Irrtümer bei der Übermittlung besteht keine Haftung.
This e-mail is intended solely for the person to whom it is addressed and may contain confidential or legally privileged information. Access to this e-mail by anyone else is unauthorized. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and destroy this e-mail and any attachments. E-mail may be susceptible to data corruption, interception, unauthorized amendment, viruses and delays or the consequences thereof. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20220610/caa2e03f/attachment.htm>

More information about the Qt-creator mailing list