Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. how to get qtablewidgetitem from qstandarditem?

how to get qtablewidgetitem from qstandarditem?

Scheduled Pinned Locked Moved Unsolved Qt 6
4 Posts 3 Posters 611 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.
  • Y Offline
    Y Offline
    yangyanhui4
    wrote on last edited by
    #1

    Hi, I have a tableview and set a checkbox at the first column. What I want to do is to make the checkbox at certain rows disable and cannot be checked. I can get the qstandarditem of the cell. I want to get qtablewidgetitem from it and set the checkbox disabled.But I cant find any function to realize it.
    What method can I use to realize the function?
    thanks

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      A QTableWidgetItem is a special item of a QTableWidget and can't be used in a plain QTableView.
      So what do you really do and what are you trying to achieve?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • Y Offline
        Y Offline
        yangyanhui4
        wrote on last edited by
        #3

        I want to make the checkbox in some rows disabled.

        JonBJ 1 Reply Last reply
        0
        • Y yangyanhui4

          I want to make the checkbox in some rows disabled.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @yangyanhui4
          enum Qt::ItemFlag has

          Qt::ItemIsUserCheckable 16 It can be checked or unchecked by the user.

          You want that to be unset on the items where the checkbox is to be disabled. See e.g. https://forum.qt.io/topic/120725/qtableview-show-checkbox-but-keep-it-disabled/8.

          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