Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Custom Selection in QTableView



  • 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



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


Log in to reply