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. Instantiate Qt widgets on slot of QTableView

Instantiate Qt widgets on slot of QTableView

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 1.5k 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.
  • M Offline
    M Offline
    moravas
    wrote on last edited by
    #1

    Hi Folks,

    I have a QTableView instance, that has two collums. The question is:
    how can I instance QComboBox or QCheckbox or something like that into a slot of my QTableView?
    Is there any possibility to display other widgets on the slots?

    Regards,
    Norbert

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      we have a "wiki page for that":http://qt-project.org/wiki/Combo_Boxes_in_Item_Views

      for the checkbox part, have a look at checkable.
      What model are you using?

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • M Offline
        M Offline
        moravas
        wrote on last edited by
        #3

        Hi,

        thank you for the reply, I tried your suggestion out, but it doesn't work.
        I use QTableView and QStandardItemModel. What did I make wrong?

        Regards

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          Did you try the example?

          What exactly goes wrong?

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • M Offline
            M Offline
            moravas
            wrote on last edited by
            #5

            Hi,

            yes, I copied the example, but it doesn't displays the combobox on my QTableView. Please consider, that I'm using QTableView insted of QTableWidget.

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6

              What version of Qt are you using?

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #7

                For a QTableView you could use :
                @
                tw.setModel(model); // your QStandardItemModel
                @

                instead of
                @
                tw.setColumnCount(4);
                tw.setRowCount(10);
                @

                hope it helps

                Qt Certified Specialist
                www.edalsolutions.be

                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