title: HowTo find Subitem in QAbstractItemModel and QTreeView class?
body: <p><strong>Question</strong>: how to find sub item, in a <code>QTreeView</code> loaded <code>QAbstractItemModel</code> model with <code>model-&gt;match()</code> method?</p>
  
  <p><strong>Problem</strong>: <code>model-&gt;match()</code> can't find sub items, wtf?!</p>
  
  <p>Here is the example:</p>
  
  <p><a href="https://i.stack.imgur.com/slkey.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/slkey.png" alt="alt text"></a>
  </p>
  
  <p>As you can see from the picture, I'm trying to expand <code>Layouts</code> sub item with this code:</p>
  
  <pre><code>void Dialog::restoreState(void)
  {
      // get list
      QSettings settings("settings.ini", QSettings::IniFormat);
      settings.beginGroup("MainWindow");
      QStringList List = settings.value("ExpandedItems").toStringList();
      settings.endGroup();
  
      foreach (QString item, List)
      {
          if (item.contains('|'))
              item = item.split('|').last();
          // search `item` text in model
          QModelIndexList Items = model-&gt;match(model-&gt;index(0, 0), Qt::DisplayRole, QVariant::fromValue(item));
          if (!Items.isEmpty())
          {
              // Information: with this code, expands ONLY first level in QTreeView
              view-&gt;setExpanded(Items.first(), true);
          }
      }
  }
  </code></pre>
  
  <p>Where <code>settings.ini</code> file contains:</p>
  
  <pre><code>[MainWindow]
  ExpandedItems=Using Containers, Connection Editing Mode, Form Editing Mode, Form Editing Mode|Layouts
  </code></pre>
  
  <hr>
  
  <p>PS: root items successfully expands on start!</p>