title: How to set currentIndex of SwipeView to currentIndex of TabBar "by reference" after going to specific page?
body: <p>I'm getting started with QtQuick Controls 2.0. I have experience with C++ and a small amount of experience with Qt, but I have not worked with QML before.</p>
  
  <p>I have a <code>TabBar</code> and a <code>SwipeView</code> that are linked to each other. What I mean by this is that when you select a page on the <code>TabBar</code>, the <code>SwipeView</code> goes to that page. When you swipe to a page from the <code>SwipeView</code>, the <code>TabBar</code> updates itself to reflect that.</p>
  
  <p>As a learning exercise, I decided to create a button that would send the user to the second page. The issue is that I can't seem to find a way to do so without messing up the link between the <code>TabBar</code> and the <code>SwipeView</code>.</p>
  
  <p>The following code is the best I've come up with. It correctly goes to the second page, and when I change the current page with the <code>TabBar</code> the <code>SwipeView</code> still updates. However, <em>swiping</em> to a new page no longer updates the <code>TabBar</code>. It appears that setting <code>tabBar.currentIndex</code> to <code>swipeView.currentIndex</code> only has the effect of setting by reference when done with the colon to initialize. Doing so with an equals sign sets by value. How can I move to a specific page while still maintaining the invariant that <code>swipeView.currentIndex == tabBar.currentIndex</code>?</p>
  
  <pre><code>// main.qml
  import QtQuick 2.7
  import QtQuick.Controls 2.0
  import QtQuick.Layouts 1.0
  
  ApplicationWindow {
      visible: true
      width: 640
      height: 480
      title: qsTr("Hello World")
      SwipeView {
          id: swipeView
          anchors.fill: parent
          currentIndex: tabBar.currentIndex
  
          Page {
              Button {
                  text: qsTr("Continue to Page 2")
                  onClicked: {
                      tabBar.currentIndex = 1;
                      // this next line merely sets tabBar.currentIndex to 1
                      tabBar.currentIndex = swipeView.currentIndex
                  }
                  anchors.centerIn: parent
                  width: text.implicitWidth
                  height: text.implicitHeight
              }
          }
  
          Page {
              Label {
                  text: qsTr("Second page")
                  anchors.centerIn: parent
              }
          }
      }
  
      footer: TabBar {
          id: tabBar
          currentIndex: swipeView.currentIndex
          TabButton {
              text: qsTr("First")
          }
          TabButton {
              text: qsTr( "Second")
          }
      }
  }
  </code></pre>
  
  <p>The C++ code  is simply the default that Qt Creator provided for me:</p>
  
  <pre><code>// main.cpp
  #include &lt;QGuiApplication&gt;
  #include &lt;QQmlApplicationEngine&gt;
  
  int main(int argc, char *argv[])
  {
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      QGuiApplication app(argc, argv);
  
      QQmlApplicationEngine engine;
      engine.load(QUrl(QLatin1String("qrc:/main.qml")));
  
      return app.exec();
  }
  </code></pre>