Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53256

Add selectRow with model index in TreeView.qml

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.6.0
    • Quick: Controls 1
    • None
    • QML

    Description

      Add a function in TreeView in order to can change the selected row with a model index.

      TreeView.qml line 86
          function selectRow(index)
          {
              var row = 0;
              var indexList = [];
      
              while (index.valid)
              {
                  indexList.push(index);
                  index = index.parent;
              }
      
              while (indexList.length > 0)
              {
                  var targetIndex = indexList.pop();
      
                  while (modelAdaptor.mapRowToModelIndex(row) !== targetIndex)
                  {
                      if (!modelAdaptor.mapRowToModelIndex(row).valid)
                      {
                          console.warn("Row not found")
                          return;
                      }
      
                      row++;
                  }
      
                  if (indexList.length > 0)
                  {
                      expand(modelAdaptor.mapRowToModelIndex(row));
                  }
              }
      
              __currentRow = row;
          }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            zapco Olivier Percheron
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes