title: Get active Tab from TabView and change item property
body: <p>In the <a href="https://stackoverflow.com/questions/33536881/set-loader-item-property">context</a> of a dual-pane file manager, I have two <code>TabView</code> items side by side, each contains multiple tabs of course, and each <code>Tab</code> loads a <code>TableView</code> showing the content of a specific directory using <code>FolderListModel</code>.</p>
  
  <pre><code>SplitView
      TabView
          Tab
          Tab
      TabView
          Tab
  </code></pre>
  
  <p>My current task is to implement a toolbar button to toggle the <code>showHidden</code> property of the <code>FolderListModel</code> instance shown in the <strong>active</strong> tab. Therefore, I need a way to find out what the currently active tab is.</p>
  
  <p>Next, once I get the active <code>Tab</code>, I need to change <code>Tab.item.some_property</code>, in particular, the property of interest is <code>show_hidden</code>, which is an alias to the <code>showHidden</code> property of the underlying <code>FolderListModel</code>. For example, a hard-coded scenario would be:</p>
  
  <pre><code>ToolButton {
      onClicked: {
          tab1.item.show_hidden = false;
          tab1.destroy();  // need "refresh" instead
      }
  }
  </code></pre>
  
  <p>First I need to get <code>tab1</code> based on whether it is active, and second, after I change <code>show_hidden</code>, the view doesn't refresh by itself, so I need to call some kind of reload function, but which? Or maybe reload isn't the best way to do it? Is it possible to do it using a custom signal handler? (Again I can only think conceptually without knowing how to implement it.)</p>
  
  <p>As suggested I'm posting a running example below:</p>
  
  <pre><code>/* main.qml */
  import QtQuick 2.4
  import QtQuick.Controls 1.4
  import QtQuick.Layouts 1.1
  
  ApplicationWindow {
      visible: true
      width: 1280
      height: 700
  
      toolBar: ToolBar {
          RowLayout {
              anchors.fill: parent
  
              ToolButton {
                  onClicked: {    // TODO toggle folderModel.showHidden property
                      tab1A.item.show_hidden = false;
  //                    tab1A.destroy();  // fixme how to refresh the view?
                  }
              }
          }
      }
  
      Item {
          anchors.fill: parent
  
          SplitView {
              id: splitView
              anchors.fill: parent
  
              TabView {
                  id: tabView1
                  width: splitView.width / 2
  
                  Tab {
                      id: tab1A
  
                      title: qsTr("Home")
                      source: "dirview.qml"
  
                      onLoaded: {
                          item.folder_url = "file:///tmp";
                      }
                  }
  
                  Tab {
                      title: qsTr("Folder")
                      source: "dirview.qml"
                      onLoaded: {
                          item.folder_url = "file:///home";
                      }
                  }
              }
  
              TabView {
                  id: tabView2
  
                  Tab {
                      title: qsTr("Home")
                      source: "dirview.qml"
                      onLoaded: {
                          item.folder_url = "file:///home";
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>/* dirview.qml */
  import QtQuick 2.4
  import QtQuick.Controls 1.4
  import Qt.labs.folderlistmodel 2.1
  
  TableView {
      property alias folder_url: folderModel.folder
      property alias show_hidden: folderModel.showHidden
  
      id: tableView
      anchors.fill: parent
  
      TableViewColumn {
          role: "fileName"
          title: qsTr("Name")
          width: tableView.width * 0.7
      }
  
      TableViewColumn {
          role: "fileSize"
          title: qsTr("Size")
          width: tableView.width * 0.2
      }
  
      FolderListModel {
          id: folderModel
          nameFilters: ["*"]
          showHidden: true
          showDirsFirst: true
          showDotAndDotDot: true
      }
  
      model: folderModel
  }
  </code></pre>
  
  <p>Thank you.</p>
  
  <hr>
  
  <p>Noticed something weird: <code>Tab.item.folder_url</code> has the right info, however, <code>Tab.item.show_hidden</code> is always <code>false</code>, even if I remove the line where I manually set it to <code>false</code>. This is hard to understand as I initially set <code>FolderListModel.showHidden</code> to <code>true</code> in <code>dirview.qml</code>.</p>
  
  <pre><code>ToolButton {
      onClicked: {    // TODO toggle folderModel.showHidden property
          var cur_tab_idx = tabView1.currentIndex;
  
          console.log(tabView1.getTab(cur_tab_idx).item.folder_url);
          console.log(tabView1.getTab(cur_tab_idx).item.show_hidden);
      }
  }
  </code></pre>