Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Instantiate Qt widgets on slot of QTableView

    General and Desktop
    2
    7
    1192
    Loading More Posts
    • 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
      moravas last edited by

      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 Reply Quote 0
      • E
        Eddy last edited by

        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 Reply Quote 0
        • M
          moravas last edited by

          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 Reply Quote 0
          • E
            Eddy last edited by

            Did you try the example?

            What exactly goes wrong?

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply Reply Quote 0
            • M
              moravas last edited by

              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 Reply Quote 0
              • E
                Eddy last edited by

                What version of Qt are you using?

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply Reply Quote 0
                • E
                  Eddy last edited by

                  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 Reply Quote 0
                  • First post
                    Last post