import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Window { id: window width: 640 height: 480 visible: true TabBar { id: bar width: parent.width TabButton { text: "page1" } TabButton { text: "page2" } } StackLayout { anchors.top: bar.bottom width: parent.width currentIndex: bar.currentIndex Item { id: page1 Rectangle { width: 300 height: 300 color: "orange" Text { anchors.centerIn: parent text: "Double click here, than come back and try to single click\n" +"The first single will not be printed to the console." } MouseArea { anchors.fill: parent onClicked: console.log("clicked") onDoubleClicked: { console.log("double clicked") bar.currentIndex = 1; } } } } Text { text: "page2" } } }