Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use Designer to implement a nested widget?
Forum Updated to NodeBB v4.3 + New Features

How to use Designer to implement a nested widget?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 450 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    seasoul
    wrote on last edited by
    #1

    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?

    VRoninV 1 Reply Last reply
    0
    • S seasoul

      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?

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      @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

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved