Selecting a row in QTreeView programmatically

Selecting a row in QTreeView programmatically

Asked on January 11, 2019 in Qt.
Add Comment


  • 2 Answer(s)

    By using the Qitem selection :

    selection->select (
        QItemSelection (
           treeview->model ()->index (search, 0),
           treeview->model ()->index (search, treeview->model ()->columnCount () - 1)),
        QItemSelectionModel::Select);
    

    Click  to set the choice action:

    treeview->setSelectionBehavior (QAbstractItemView::SelectRows)
    
    Answered on January 11, 2019.
    Add Comment

    Row in QTreeView programmatically:

    Unified the  row using an QItemSelection.

    selection->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
    
    

    By clearing the solutions:

    selection->select(idx, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
    
    
    Answered on January 11, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.