Trouble changing selection mode for a QTableWidget



  • Everything is fine when I do the following:
    @
    logTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    @

    (logTable is a pointer to a QTableWidget)

    Then I tried changing the SelectRows to NoSelection. NoSelection is in the documentation as a valid choice, but I get the error:
    No matching function for call to 'setSelectionBehavior(QAbstractItemView::NoSelection)'

    I don't want any of the items in the table to be selected. How do I do this?



  • You're mixing behavior and mode:

    setSelectionBehavior() takes on of "this values":/doc/qt-4.8/qabstractitemview.html#SelectionBehavior-enum (items, rows, columns).

    You want to call setSelectionMode(), which takes, among QAbstractItemView::NoSelection, "those values":/doc/qt-4.8/qabstractitemview.html#SelectionMode-enum.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.