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. QTablewidget with combobox and doublespinbox
QtWS25 Last Chance

QTablewidget with combobox and doublespinbox

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 12.6k 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.
  • A Offline
    A Offline
    alberto.adami
    wrote on last edited by
    #1

    Hi, i am new in Qt and i have to do a project that draw Chart of statistics dates.
    I have create a qtablewidget for rappresented the dates, but i have a problem:
    I want to create the rows with combobox and qdobulespinbox.
    In particular i want that when index 1 of my combo is checked the item of column 2 and column 3 are disabled.
    The column of my table are always the same
    How can i do this connection??
    Excuse me if my english is not good..

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi!
      look at "qabstractitemdelegate":http://qt-project.org/doc/qt-5.0/qtwidgets/qabstractitemdelegate.html
      and examples
      "spinboxdelegate":http://qt-project.org/doc/qt-5/qtwidgets-itemviews-spinboxdelegate-example.html
      "spreadsheet":http://qt-project.org/doc/qt-5.0/qtwidgets/itemviews-spreadsheet.html
      "stardelegate":http://qt-project.org/doc/qt-5.0/qtwidgets/itemviews-stardelegate.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alberto.adami
        wrote on last edited by
        #3

        but if i need of a combobox and 3 doublespinbox i have to create a delegate for each widget that i need in my qtablewidget??

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qxoz
          wrote on last edited by
          #4

          You can find out column from QModelIndex in createEditor, setEditorData, setModelData and do different thing in different cases.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alberto.adami
            wrote on last edited by
            #5

            I see in the documentation of Qtablewidget that exist a method setcellwidget(...), whats's the difference between use this or delegate??
            Thank you for your reply

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              setCellWidget sets a specific widget to be displayed to a specific cell.

              The delegate provides custom display features and editor widgets. So i.e. you don't have to set a widget on every cell, the view will use the delegate to create the appropriate editor.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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