1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the Qt Components project.
9 ** $QT_BEGIN_LICENSE:BSD$
10 ** You may use this file under the terms of the BSD license as follows:
12 ** "Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
15 ** * Redistributions of source code must retain the above copyright
16 ** notice, this list of conditions and the following disclaimer.
17 ** * Redistributions in binary form must reproduce the above copyright
18 ** notice, this list of conditions and the following disclaimer in
19 ** the documentation and/or other materials provided with the
21 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 ** the names of its contributors may be used to endorse or promote
23 ** products derived from this software without specific prior written
26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
39 ****************************************************************************/
47 property bool showStatusBar: true
48 property bool showToolBar: true
49 property variant initialPage
50 property alias pageStack: stack
52 property bool platformSoftwareInputPanelEnabled: false
54 Component.onCompleted: {
55 contentArea.initialized = true
56 if (initialPage && stack.depth == 0)
57 stack.push(initialPage, null, true)
60 onInitialPageChanged: {
61 if (initialPage && contentArea.initialized) {
63 stack.push(initialPage, null, true)
64 else if (stack.depth == 1)
65 stack.replace(initialPage, null, true)
69 onOrientationChangeStarted: {
70 statusBar.orientation = screen.currentOrientation
76 property bool initialized: false
79 top: sbar.bottom; bottom: sip.top;
80 left: parent.left; right: parent.right;
94 state: root.showStatusBar ? "Visible" : "Hidden"
95 platformInverted: root.platformInverted
100 PropertyChanges { target: sbar; y: 0; opacity: 1 }
104 PropertyChanges { target: sbar; y: -height; opacity: 0 }
110 from: "Hidden"; to: "Visible"
112 NumberAnimation { target: sbar; properties: "y"; duration: 200; easing.type: Easing.OutQuad }
113 NumberAnimation { target: sbar; properties: "opacity"; duration: 200; easing.type: Easing.Linear }
117 from: "Visible"; to: "Hidden"
119 NumberAnimation { target: sbar; properties: "y"; duration: 200; easing.type: Easing.Linear }
120 NumberAnimation { target: sbar; properties: "opacity"; duration: 200; easing.type: Easing.Linear }
129 anchors { bottom: parent.bottom; left: parent.left; right: parent.right }
131 Behavior on height { PropertyAnimation { duration: 200 } }
135 name: "Visible"; when: inputContext.visible && root.platformSoftwareInputPanelEnabled
136 PropertyChanges { target: sip; height: inputContext.height }
140 name: "Hidden"; when: root.showToolBar
141 PropertyChanges { target: sip; height: tbar.height }
145 name: "HiddenInFullScreen"; when: !root.showToolBar
146 PropertyChanges { target: sip; height: 0 }
155 state: root.showToolBar ? "Visible" : "Hidden"
156 platformInverted: root.platformInverted
161 PropertyChanges { target: tbar; y: parent.height - height; opacity: 1 }
165 PropertyChanges { target: tbar; y: parent.height; opacity: 0 }
171 from: "Hidden"; to: "Visible"
173 NumberAnimation { target: tbar; properties: "y"; duration: 200; easing.type: Easing.OutQuad }
174 NumberAnimation { target: tbar; properties: "opacity"; duration: 200; easing.type: Easing.Linear }
178 from: "Visible"; to: "Hidden"
180 NumberAnimation { target: tbar; properties: "y"; duration: 200; easing.type: Easing.Linear }
181 NumberAnimation { target: tbar; properties: "opacity"; duration: 200; easing.type: Easing.Linear }
187 // event preventer when page transition is active
190 enabled: pageStack.busy