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. [SOLVED]Represent data as combo box or checkbox
QtWS25 Last Chance

[SOLVED]Represent data as combo box or checkbox

Scheduled Pinned Locked Moved General and Desktop
qsqltablemodelqtableviewcustom delegate
5 Posts 2 Posters 1.8k 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
    sachi
    wrote on 14 Sept 2015, 16:35 last edited by sachi
    #1

    hi I have Qsqltablemodel containing two colomns. name and enable/disable. I want to show enable/disable as checkbox or combobox in table view. It is possible to do it? and how to do it? can i use paint function in QItemDelegate to fulfil this?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Sept 2015, 21:05 last edited by SGaist
      #2

      Hi,

      IIRC, you can make your column item flags method return the usual flags plus Qt::ItemIsUserCheckable

      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
      1
      • S Offline
        S Offline
        sachi
        wrote on 15 Sept 2015, 15:12 last edited by
        #3

        I din't understand you answer. Can you please explain further?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Sept 2015, 19:55 last edited by
          #4

          See QAbstractItemModel::flags

          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
          1
          • S Offline
            S Offline
            sachi
            wrote on 16 Sept 2015, 15:57 last edited by
            #5

            Thank you for your help. I have subclass the QSortFilterProxyModel and set flags returns Qt::ItemIsUserCheckble. it worked well

            1 Reply Last reply
            0

            3/5

            15 Sept 2015, 15:12

            • Login

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