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. Custom Selection in QTableView
Qt 6.11 is out! See what's new in the release blog

Custom Selection in QTableView

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • 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.
  • AmrCoderA Offline
    AmrCoderA Offline
    AmrCoder
    wrote on last edited by AmrCoder
    #1

    I am using Qtableview to show some data to be selected by the user and I want the data to be selected only one for each column except one column only enable it to select multi data from that column like the image I upload the last column as shown I can choose any number of items but the others it should can't choose more than one item
    here
    and refuse to select any other data from the column I give it that properties
    how can i give this propertites to the columns of this table all found how to enable to multi select for all columns by this code

    tableView->setSelectionMode(QAbstractItemView::MultiSelection);
    

    so how can I do that
    Thanks in advance

    1 Reply Last reply
    0
    • T Offline
      T Offline
      taedium
      wrote on last edited by taedium
      #2

      You could try to reimplement QAbstractItemView::selectionCommand() and define the desired behavior. Or to create your custom QItemSelectionModel.

      1 Reply Last reply
      1

      • Login

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