How to use Designer to implement a nested widget?

  • I have been coding very simple qt applications, without using Qt creator and Qt Designer. Now I want to simplify the procedure because I know sooner or later the application will be much more complicated.

    However, I met a very frequent requirement, which is to nest widgets in other widgets. For example, I want to nest a QComboBox in a Qtreewidget. A plain code maybe using "setItemWidget" but in Designer it seems impossible to drag a widget into another one.

    Do I miss some hidden functions to get this normal requirement?

  • @seasoul said in How to use Designer to implement a nested widget?:

    A plain code maybe using "setItemWidget"

    Please NOOOOO

    What you need is a QStyledItemeDelegate subclass that pains as a QComboBox and then call setItemDelegateForColumn to assign it to a QTreeWidget.

    One possible implementation is header / source

    Since a delegate is not a widget you won't be able to set it drag-drop in designer

Log in to reply