Nominate our 2022 Qt Champions!

Not possible to set layout on custom widget plugin

  • Hi,

    I am trying to create a simple widget plugin for Qt Designer. I am however stuck on a few points.

    It's a simple widget inheriting from QWidget, which has a title and a content QWidget underneath.
    When clicking on the title, the content is hidden/shown, with a small animation.
    Sources can be found here:

    I can build the plugin just fine, and it appears in Qt Designer afterwards.
    However, I cannot add a layout to my custom widget. If I add a couple of QLabels to the widget, no layout is available.
    I have set the isContainer() method to true, to no avail.
    Any idea of what I am doing wrong?

    Second question, I have defined a property "title" in the domXml() method, so the user can set the title from the Qt Designer interface.
    How can I get when this field is changed so I can change the value of the title in the widget?

    Last question, the animations depend on the height of the content, so I'd need to reset the maximumHeight value for the animations every time the content widget is modified. Is there a signal for this?


  • If you just need the final result, it's available:

  • Thanks for the link, but I am mostly interested in being able to do it all through the Qt Designer UI via a plugin.

Log in to reply