examples/declarative/keyinteraction/focus/focus.qml
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    56         GridMenu {
    56         GridMenu {
    57             id: gridMenu
    57             id: gridMenu
    58 
    58 
    59             width: parent.width; height: 320
    59             width: parent.width; height: 320
    60             focus: true
    60             focus: true
    61             interactive: parent.wantsFocus
    61             interactive: parent.activeFocus
    62         }
    62         }
    63 
    63 
    64         ListViews {
    64         ListViews {
    65             id: listViews
    65             id: listViews
    66             y: 320; width: parent.width; height: 320
    66             y: 320; width: parent.width; height: 320
    67         }
    67         }
    68 
    68 
    69         Rectangle { 
    69         Rectangle { 
    70             id: shade
    70             id: shade
    71             color: "black"; opacity: 0; anchors.fill: parent
    71             anchors.fill: parent
       
    72             color: "black"; opacity: 0 
    72         }
    73         }
    73 
    74 
    74         states: State {
    75         states: State {
    75             name: "showListViews"
    76             name: "showListViews"
    76             PropertyChanges { target: gridMenu; y: -160 }
    77             PropertyChanges { target: gridMenu; y: -160 }
    86         source: "Core/images/arrow.png"
    87         source: "Core/images/arrow.png"
    87         rotation: 90
    88         rotation: 90
    88         anchors.verticalCenter: parent.verticalCenter
    89         anchors.verticalCenter: parent.verticalCenter
    89 
    90 
    90         MouseArea {
    91         MouseArea {
    91             anchors { fill: parent; leftMargin: -10; topMargin: -10; rightMargin: -10; bottomMargin: -10 }
    92             anchors.fill: parent; anchors.margins: -10
    92             onClicked: window.state = "contextMenuOpen"
    93             onClicked: window.state = "contextMenuOpen"
    93         }
    94         }
    94     }
    95     }
    95 
    96 
    96     ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height }
    97     ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height }
    97 
    98 
    98     states: State {
    99     states: State {
    99         name: "contextMenuOpen"
   100         name: "contextMenuOpen"
   100         when: !mainView.wantsFocus
   101         when: !mainView.activeFocus
   101         PropertyChanges { target: contextMenu; x: 0; open: true }
   102         PropertyChanges { target: contextMenu; x: 0; open: true }
   102         PropertyChanges { target: mainView; x: 130 }
   103         PropertyChanges { target: mainView; x: 130 }
   103         PropertyChanges { target: shade; opacity: 0.25 }
   104         PropertyChanges { target: shade; opacity: 0.25 }
   104     }
   105     }
   105 
   106