QML state changes on double click
Hi all,
I am trying to build a touch screen of tabs, which when the central part of the screen in double clicked on, goes to a new state where there are two identical tab displays up instead of only seeing one. However, this never seems to happen. Can anyone see something wrong with this implementation?
- import QtQuick 1.1
- Item {
- width: 1540
- height: 320
- MouseArea{
- id: mouseArea
- x: 0
- y: 58
- width: 1540
- height: 262
- anchors.rightMargin: 0
- anchors.bottomMargin: 0
- anchors.leftMargin: 0
- anchors.topMargin: 58
- anchors.fill: parent
- }
- Tabs {
- width: 1540
- height: 320
- id: tabs
- }
- Tabs {
- id: tabs1
- x: 0
- y: 0
- width: 770
- height: 320
- }
- states: [
- State {
- name: "State1"; when: mouseArea.doubleClicked
- PropertyChanges {
- target: tabs
- width: 770
- height: 320
- }
- PropertyChanges {
- target: tabs1
- x: 770
- y: 0
- width: 770
- height: 320
- }
- }
- ]
- }
2 replies
For anyone interested, I was able to fix this by using onDoubleClicked within the mouseArea tag, and then having that change a property bool. Using mouseArea.doubleClicked like above doesn’t work. Solution:
- property bool twoScreens: false
- MouseArea{
- id: mouseArea
- onDoubleClicked: twoScreens = !twoScreens
- }
- states: [
- State {
- name: "State1"; when: twoScreens
You must log in to post a reply. Not a member yet? Register here!
