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 create a double-layer qcombobox for qtableview cell

How create a double-layer qcombobox for qtableview cell

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 576 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    konata
    wrote on last edited by
    #1

    dafa888f-4590-4d15-9daf-19a3192e5fac-image.png

    one of the way is to set a qmenu delegate for the tableview column but it seems that menu do not show in the right position

    Anyone has any suggestion?

    Pl45m4P 1 Reply Last reply
    0
    • K konata

      dafa888f-4590-4d15-9daf-19a3192e5fac-image.png

      one of the way is to set a qmenu delegate for the tableview column but it seems that menu do not show in the right position

      Anyone has any suggestion?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @konata '

      Create your own QItemDelegate subclass and implement your comboBox there. I guess you have to specify the behavior, where and how the 2nd dropdown appears, on your own since there is no such standard widget in Qt.

      https://stackoverflow.com/questions/16660292/qt-using-custom-qitemdelegate-for-qtableview

      Is that screenshot shwoing how it looks like at the moment or how you want it to look like?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      K 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @konata '

        Create your own QItemDelegate subclass and implement your comboBox there. I guess you have to specify the behavior, where and how the 2nd dropdown appears, on your own since there is no such standard widget in Qt.

        https://stackoverflow.com/questions/16660292/qt-using-custom-qitemdelegate-for-qtableview

        Is that screenshot shwoing how it looks like at the moment or how you want it to look like?

        K Offline
        K Offline
        konata
        wrote on last edited by
        #3

        @Pl45m4 thanks for reply
        Yes I found it a bit hard for me to draw a second combobox by QItemDelegate
        The screen shot is how it should look like.
        This is more like a menu with submenu and when I choose the submenu item or action it will return its text to the editor

        Pl45m4P 1 Reply Last reply
        0
        • K konata

          @Pl45m4 thanks for reply
          Yes I found it a bit hard for me to draw a second combobox by QItemDelegate
          The screen shot is how it should look like.
          This is more like a menu with submenu and when I choose the submenu item or action it will return its text to the editor

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @konata

          Where does the 2nd window appear? Are you using cascading QMenus? Is everything else fine except the position?
          https://doc.qt.io/qt-5/qmenu.html#addMenu
          https://stackoverflow.com/questions/13799033/how-to-add-submenu-in-qt


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          K 1 Reply Last reply
          0
          • Pl45m4P Pl45m4

            @konata

            Where does the 2nd window appear? Are you using cascading QMenus? Is everything else fine except the position?
            https://doc.qt.io/qt-5/qmenu.html#addMenu
            https://stackoverflow.com/questions/13799033/how-to-add-submenu-in-qt

            K Offline
            K Offline
            konata
            wrote on last edited by
            #5

            @Pl45m4
            I guess the 2nd window(combobox)should be just close to the first one
            I have tried using Qmenus in delegate but the menu appeared in position (0,0) and it only show first row and cannot choose or select
            I searched the forum and it seems that no one used qmenus in delegates before

            1 Reply Last reply
            0

            • Login

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