summaryrefslogtreecommitdiff
path: root/src/qtdesktop/private
diff options
context:
space:
mode:
Diffstat (limited to 'src/qtdesktop/private')
-rw-r--r--src/qtdesktop/private/BasicButton.qml110
-rw-r--r--src/qtdesktop/private/ButtonBehavior.qml61
-rw-r--r--src/qtdesktop/private/ButtonGroup.js141
-rw-r--r--src/qtdesktop/private/ModalPopupBehavior.qml130
-rw-r--r--src/qtdesktop/private/PageSlideTransition.qml133
-rw-r--r--src/qtdesktop/private/PageStack.js67
-rw-r--r--src/qtdesktop/private/ScrollAreaHelper.qml123
-rw-r--r--src/qtdesktop/private/ScrollBar.qml212
-rw-r--r--src/qtdesktop/private/Splitter.qml471
-rw-r--r--src/qtdesktop/private/TabBar.qml152
10 files changed, 0 insertions, 1600 deletions
diff --git a/src/qtdesktop/private/BasicButton.qml b/src/qtdesktop/private/BasicButton.qml
deleted file mode 100644
index 1e583831..00000000
--- a/src/qtdesktop/private/BasicButton.qml
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0 as Internal
-
-Item {
- id: button
-
- signal clicked
- property alias pressed: behavior.effectivePressed
- property alias containsMouse: behavior.containsMouse
- property alias checkable: behavior.checkable // button toggles between checked and !checked
- property alias checked: behavior.checked
- property bool activeFocusOnPress: false
- property alias style: loader.sourceComponent
- property var styleHints: []
-
- property color textColor: syspal.text
- property string tooltip
-
- Accessible.role: Accessible.Button
- Accessible.description: tooltip
-
- signal toolTipTriggered
-
- // implementation
-
- property string __position: "only"
- implicitWidth: loader.implicitWidth
- implicitHeight: loader.implicitHeight
-
- Keys.onPressed: {
- if (event.key === Qt.Key_Space && !event.isAutoRepeat && !behavior.pressed)
- behavior.keyPressed = true;
- }
-
- Keys.onReleased: {
- if (event.key === Qt.Key_Space && !event.isAutoRepeat && behavior.keyPressed) {
- behavior.keyPressed = false;
- if (checkable)
- checked = !checked;
- button.clicked();
- }
- }
-
- Loader {
- id: loader
- anchors.fill: parent
- sourceComponent: style
- property alias control: button
- property alias position: button.__position
- height: item ? item.implicitHeight : 0
- width: item ? item.implicitWidth : 0
- }
-
- ButtonBehavior {
- id: behavior
- anchors.fill: parent
- onClicked: button.clicked()
- onExited: Internal.PrivateHelper.hideToolTip()
- onCanceled: Internal.PrivateHelper.hideToolTip()
- onPressed: if (activeFocusOnPress) button.forceActiveFocus()
-
- Timer {
- interval: 1000
- running: containsMouse && !pressed && tooltip.length
- onTriggered: Internal.PrivateHelper.showToolTip(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip)
- }
- }
-
- SystemPalette { id: syspal }
-}
diff --git a/src/qtdesktop/private/ButtonBehavior.qml b/src/qtdesktop/private/ButtonBehavior.qml
deleted file mode 100644
index 1119811c..00000000
--- a/src/qtdesktop/private/ButtonBehavior.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-MouseArea {
- property bool checkable: false
- property bool checked: false
- property bool keyPressed: false
- property bool effectivePressed: pressed && containsMouse || keyPressed
-
- hoverEnabled: true
- enabled: !keyPressed
-
- onCheckableChanged: {
- if (!checkable)
- checked = false;
- }
-
- onReleased: {
- if (checkable && containsMouse)
- checked = !checked;
- }
-}
diff --git a/src/qtdesktop/private/ButtonGroup.js b/src/qtdesktop/private/ButtonGroup.js
deleted file mode 100644
index 5b0d9adb..00000000
--- a/src/qtdesktop/private/ButtonGroup.js
+++ /dev/null
@@ -1,141 +0,0 @@
-var self;
-var checkHandlers = [];
-var visibleButtons = [];
-var nonVisibleButtons = [];
-var direction;
-
-function create(that, options) {
- self = that;
- direction = options.direction || Qt.Horizontal;
- self.childrenChanged.connect(rebuild);
-// self.widthChanged.connect(resizeChildren);
- build();
-}
-
-function isButton(item) {
- if (item && item.hasOwnProperty("__position"))
- return true;
- return false;
-}
-
-function hasChecked(item) {
- return (item && item.hasOwnProperty("checked"));
-}
-
-function destroy() {
- self.childrenChanged.disconnect(rebuild);
-// self.widthChanged.disconnect(resizeChildren);
- cleanup();
-}
-
-function build() {
- visibleButtons = [];
- nonVisibleButtons = [];
-
- for (var i = 0, item; (item = self.children[i]); i++) {
-
- if (item.hasOwnProperty("styleHint"))
- item.styleHint = styleHint;
-
- if (!hasChecked(item))
- continue;
-
- item.visibleChanged.connect(rebuild); // Not optimal, but hardly a bottleneck in your app
- if (!item.visible) {
- nonVisibleButtons.push(item);
- continue;
- }
- visibleButtons.push(item);
-
- if (self.exclusive && item.hasOwnProperty("checkable"))
- item.checkable = true;
-
- if (self.exclusive) {
- item.checked = false;
- checkHandlers.push(checkExclusive(item));
- item.checkedChanged.connect(checkHandlers[checkHandlers.length - 1]);
- }
- }
-
- var nrButtons = visibleButtons.length;
- if (nrButtons == 0)
- return;
-
- if (self.checkedButton)
- self.checkedButton.checked = true;
- else if (self.exclusive) {
- self.checkedButton = visibleButtons[0];
- self.checkedButton.checked = true;
- }
-
- if (nrButtons == 1) {
- finishButton(visibleButtons[0], "only");
- } else {
- finishButton(visibleButtons[0], direction == Qt.Horizontal ? "leftmost" : "top");
- for (var i = 1; i < nrButtons - 1; i++)
- finishButton(visibleButtons[i], direction == Qt.Horizontal ? "h_middle": "v_middle");
- finishButton(visibleButtons[nrButtons - 1], direction == Qt.Horizontal ? "rightmost" : "bottom");
- }
-}
-
-function finishButton(button, position) {
- if (isButton(button)) {
- button.__position = position;
- if (direction == Qt.Vertical) {
- button.anchors.left = self.left //mm How to make this not cause binding loops? see QTBUG-17162
- button.anchors.right = self.right
- }
- }
-}
-
-function cleanup() {
- visibleButtons.forEach(function(item, i) {
- if (checkHandlers[i])
- item.checkedChanged.disconnect(checkHandlers[i]);
- item.visibleChanged.disconnect(rebuild);
- });
- checkHandlers = [];
-
- nonVisibleButtons.forEach(function(item, i) {
- item.visibleChanged.disconnect(rebuild);
- });
-}
-
-function rebuild() {
- if (self == undefined)
- return;
-
- cleanup();
- build();
-}
-
-function resizeChildren() {
- if (direction != Qt.Horizontal)
- return;
-
- var extraPixels = self.width % visibleButtons;
- var buttonSize = (self.width - extraPixels) / visibleButtons;
- visibleButtons.forEach(function(item, i) {
- if (!item || !item.visible)
- return;
- item.width = buttonSize + (extraPixels > 0 ? 1 : 0);
- if (extraPixels > 0)
- extraPixels--;
- });
-}
-
-function checkExclusive(item) {
- var button = item;
- return function() {
- for (var i = 0, ref; (ref = visibleButtons[i]); i++) {
- if (ref.checked == (button === ref))
- continue;
-
- // Disconnect the signal to avoid recursive calls
- ref.checkedChanged.disconnect(checkHandlers[i]);
- ref.checked = !ref.checked;
- ref.checkedChanged.connect(checkHandlers[i]);
- }
- self.checkedButton = button;
- }
-}
diff --git a/src/qtdesktop/private/ModalPopupBehavior.qml b/src/qtdesktop/private/ModalPopupBehavior.qml
deleted file mode 100644
index 1e95f6f1..00000000
--- a/src/qtdesktop/private/ModalPopupBehavior.qml
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-// KNOWN ISSUES
-// none
-
-Item {
- id: popupBehavior
-
- property bool showing: false
- property bool whenAlso: true // modifier to the "showing" property
- property bool consumeCancelClick: true
- property int delay: 0 // delay before popout becomes visible
- property int deallocationDelay: 3000 // 3 seconds
-
- property Component popupComponent
-
- property alias popup: popupLoader.item // read-only
- property alias window: popupBehavior.root // read-only
-
- signal prepareToShow
- signal prepareToHide
- signal cancelledByClick
-
- // implementation
-
- anchors.fill: parent
-
- onShowingChanged: notifyChange()
- onWhenAlsoChanged: notifyChange()
- function notifyChange() {
- if(showing && whenAlso) {
- if(popupLoader.sourceComponent == undefined) {
- popupLoader.sourceComponent = popupComponent;
- }
- } else {
- mouseArea.enabled = false; // disable before opacity is changed in case it has fading behavior
- if(Qt.isQtObject(popupLoader.item)) {
- popupBehavior.prepareToHide();
- popupLoader.item.opacity = 0;
- }
- }
- }
-
- property Item root: findRoot()
- function findRoot() {
- var p = parent;
- while(p.parent != undefined)
- p = p.parent;
-
- return p;
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- enabled: false // enabled only when popout is showing
- onPressed: {
- popupBehavior.showing = false;
- mouse.accepted = consumeCancelClick;
- cancelledByClick();
- }
- }
-
- Loader {
- id: popupLoader
- }
-
- Timer { // visibility timer
- running: Qt.isQtObject(popupLoader.item) && showing && whenAlso
- interval: delay
- onTriggered: {
- popupBehavior.prepareToShow();
- mouseArea.enabled = true;
- popup.opacity = 1;
- }
- }
-
- Timer { // deallocation timer
- running: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity == 0
- interval: deallocationDelay
- onTriggered: popupLoader.sourceComponent = undefined
- }
-
- states: State {
- name: "active"
- when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity > 0
- ParentChange { target: popupBehavior; parent: root }
- }
- }
-
diff --git a/src/qtdesktop/private/PageSlideTransition.qml b/src/qtdesktop/private/PageSlideTransition.qml
deleted file mode 100644
index aed74d68..00000000
--- a/src/qtdesktop/private/PageSlideTransition.qml
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0
-
-PageTransition {
- id: root
-
- property bool horizontal: true
-
- function getAnimation(properties)
- {
- return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name]
- }
-
- function cleanupAnimation(properties)
- {
- properties.exitPage.x = 0
- properties.exitPage.y = 0
- }
-
- property QtObject horizontalSlide: QtObject {
- property Component pushAnimation: PageAnimation {
- PropertyAnimation {
- target: enterPage
- property: "x"
- from: target.width
- to: 0
- duration: 300
- }
- PropertyAnimation {
- target: exitPage
- property: "x"
- from: 0
- to: -target.width
- duration: 300
- }
- }
-
- property Component popAnimation: PageAnimation {
- PropertyAnimation {
- target: enterPage
- property: "x"
- from: -target.width
- to: 0
- duration: 300
- }
- PropertyAnimation {
- target: exitPage
- property: "x"
- from: 0
- to: target.width
- duration: 300
- }
- }
- property Component replaceAnimation: pushAnimation
- }
-
- property QtObject verticalSlide: QtObject {
- property Component pushAnimation: PageAnimation {
- PropertyAnimation {
- target: enterPage
- property: "y"
- from: target.height
- to: 0
- duration: 300
- }
- PropertyAnimation {
- target: exitPage
- property: "y"
- from: 0
- to: -target.height
- duration: 300
- }
- }
-
- property Component popAnimation: PageAnimation {
- PropertyAnimation {
- target: enterPage
- property: "y"
- from: -target.height
- to: 0
- duration: 300
- }
- PropertyAnimation {
- target: exitPage
- property: "y"
- from: 0
- to: target.height
- duration: 300
- }
- property Component replaceAnimation: pushAnimation
- }
- }
-}
diff --git a/src/qtdesktop/private/PageStack.js b/src/qtdesktop/private/PageStack.js
deleted file mode 100644
index 97f292d5..00000000
--- a/src/qtdesktop/private/PageStack.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-var pageStack = [];
-
-function push(p)
-{
- if (!p)
- return
- pageStack.push(p)
- __depth++
- return p
-}
-
-function pop()
-{
- if (pageStack.length === 0)
- return null
- var p = pageStack.pop()
- __depth--
- return p
-}
-
-function current()
-{
- if (pageStack.length === 0)
- return null
- return pageStack[pageStack.length-1]
-}
-
diff --git a/src/qtdesktop/private/ScrollAreaHelper.qml b/src/qtdesktop/private/ScrollAreaHelper.qml
deleted file mode 100644
index e99b3276..00000000
--- a/src/qtdesktop/private/ScrollAreaHelper.qml
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0
-
-WheelArea {
- id: wheelarea
-
- property alias horizontalScrollBar: hscrollbar
- property alias verticalScrollBar: vscrollbar
- property int macOffset: styleitem.style == "mac" ? 1 : 0
- property bool blockUpdates: false
- property int availableHeight : height - (hscrollbar.visible ? hscrollbar.height : 0)
- property int availableWidth: width - vscrollbar.width
-
- anchors.fill: parent
- anchors.margins: frameWidth
- horizontalMinimumValue: hscrollbar.minimumValue
- horizontalMaximumValue: hscrollbar.maximumValue
- verticalMinimumValue: vscrollbar.minimumValue
- verticalMaximumValue: vscrollbar.maximumValue
-
- onVerticalValueChanged: {
- if (!blockUpdates)
- verticalScrollBar.value = verticalValue
- }
-
- onHorizontalValueChanged: {
- if (!blockUpdates)
- horizontalScrollBar.value = horizontalValue
- }
-
- StyleItem {
- // This is the filled corner between scrollbars
- id: cornerFill
- elementType: "scrollareacorner"
- width: vscrollbar.width
- anchors.right: parent.right
- height: hscrollbar.height
- anchors.bottom: parent.bottom
- visible: hscrollbar.visible && vscrollbar.visible
- }
-
- ScrollBar {
- id: hscrollbar
- orientation: Qt.Horizontal
- visible: contentWidth > availableWidth
- maximumValue: contentWidth > availableWidth ? root.contentWidth - availableWidth : 0
- minimumValue: 0
- anchors.bottom: parent.bottom
- anchors.leftMargin: parent.macOffset
- anchors.bottomMargin: -parent.macOffset
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.rightMargin: vscrollbar.visible ? vscrollbar.width -parent.macOffset: 0
- onValueChanged: {
- if (!blockUpdates) {
- contentX = value
- horizontalValue = value
- }
- }
- }
-
- ScrollBar {
- id: vscrollbar
- orientation: Qt.Vertical
- // We cannot bind directly to tree.height due to binding loops so we have to redo the calculation here
- // visible: contentHeight > availableHeight
- maximumValue: contentHeight > availableHeight ? root.contentHeight - availableHeight : 0
- minimumValue: 0
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.topMargin: 1//parent.macOffset
- anchors.rightMargin: -parent.macOffset
- anchors.bottomMargin: hscrollbar.visible ? hscrollbar.height - parent.macOffset : 0
-
- onValueChanged: {
- if (!blockUpdates) {
- contentY = value
- verticalValue = value
- }
- }
- }
-}
diff --git a/src/qtdesktop/private/ScrollBar.qml b/src/qtdesktop/private/ScrollBar.qml
deleted file mode 100644
index 9271b52d..00000000
--- a/src/qtdesktop/private/ScrollBar.qml
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0
-import "../Styles/Settings.js" as Settings
-
-/*!
- \qmltype ScrollBar
- \inqmlmodule QtDesktop 1.0
- \brief ScrollBar is doing bla...bla...
-*/
-
-Item {
- id: scrollbar
-
- property int orientation: Qt.Horizontal
- property alias minimumValue: slider.minimumValue
- property alias maximumValue: slider.maximumValue
- property int pageStep: internal.horizontal ? width : height
- property int singleStep: 20
- property alias value: slider.value
- property bool scrollToClickposition: internal.scrollToClickPosition
-
- implicitWidth: loader.implicitWidth
- implicitHeight: loader.implicitHeight
-
- onValueChanged: internal.updateHandle()
-
- property Component style: Qt.createComponent("../" + Settings.THEME_PATH + "/ScrollBarStyle.qml", scrollbar)
-
- property bool upPressed
- property bool downPressed
-
- property bool pageUpPressed
- property bool pageDownPressed
-
- MouseArea {
- id: internal
-
- property bool horizontal: orientation === Qt.Horizontal
- property alias styleItem: loader.item
-
- anchors.fill: parent
-
- property bool autoincrement: false
- property bool scrollToClickPosition: styleItem ? styleItem.scrollToClickPosition : 0
- property bool handlePressed
-
- // Update hover item
- onEntered: styleItem.activeControl = styleItem.hitTest(mouseX, mouseY)
- onExited: styleItem.activeControl = "none"
- onMouseXChanged: styleItem.activeControl = styleItem.hitTest(mouseX, mouseY)
- hoverEnabled: true
-
- property variant control
- property variant pressedX
- property variant pressedY
- property int oldPosition
- property int grooveSize
-
- Timer {
- running: upPressed || downPressed || pageUpPressed || pageDownPressed
- interval: 350
- onTriggered: internal.autoincrement = true
- }
-
- Timer {
- running: internal.autoincrement
- interval: 60
- repeat: true
- onTriggered: upPressed ? internal.decrement() : downPressed ? internal.increment() :
- pageUpPressed ? internal.decrementPage() :
- internal.incrementPage()
- }
-
- onPositionChanged: {
- if (pressed && control === "handle") {
- //slider.positionAtMaximum = grooveSize
- if (!horizontal)
- slider.position = oldPosition + (mouseY - pressedY)
- else
- slider.position = oldPosition + (mouseX - pressedX)
- }
- }
-
- onPressed: {
- control = styleItem.hitTest(mouseX, mouseY)
- scrollToClickposition = scrollToClickPosition
- grooveSize = horizontal ? styleItem.subControlRect("groove").width -
- styleItem.subControlRect("handle").width:
- styleItem.subControlRect("groove").height -
- styleItem.subControlRect("handle").height;
- if (control == "handle") {
- pressedX = mouseX
- pressedY = mouseY
- oldPosition = slider.position
- } else if (control == "up") {
- decrement();
- upPressed = true
- } else if (control == "down") {
- increment();
- downPressed = true
- } else if (!scrollToClickposition){
- if (control == "upPage") {
- decrementPage();
- pageUpPressed = true
- } else if (control == "downPage") {
- incrementPage();
- pageDownPressed = true
- }
- } else {
- slider.position = horizontal ? mouseX - handleRect.width/2
- : mouseY - handleRect.height/2
- }
- }
-
- onReleased: {
- autoincrement = false;
- upPressed = false;
- downPressed = false;
- pageUpPressed = false
- pageDownPressed = false
- control = ""
- }
-
- function incrementPage() {
- value += pageStep
- if (value > maximumValue)
- value = maximumValue
- }
-
- function decrementPage() {
- value -= pageStep
- if (value < minimumValue)
- value = minimumValue
- }
-
- function increment() {
- value += singleStep
- if (value > maximumValue)
- value = maximumValue
- }
-
- function decrement() {
- value -= singleStep
- if (value < minimumValue)
- value = minimumValue
- }
-
- Loader {
- id: loader
- property Item control: scrollbar
- sourceComponent: style
- anchors.fill: parent
- }
-
- property rect handleRect: Qt.rect(0,0,0,0)
- property rect grooveRect: Qt.rect(0,0,0,0)
- function updateHandle() {
- internal.handleRect = styleItem.subControlRect("handle")
- grooveRect = styleItem.subControlRect("groove");
- }
-
- RangeModel {
- id: slider
- minimumValue: 0.0
- maximumValue: 1.0
- value: 0
- stepSize: 0.0
- inverted: false
- positionAtMaximum: internal.grooveSize
- }
- }
-}
diff --git a/src/qtdesktop/private/Splitter.qml b/src/qtdesktop/private/Splitter.qml
deleted file mode 100644
index b24840b6..00000000
--- a/src/qtdesktop/private/Splitter.qml
+++ /dev/null
@@ -1,471 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0
-
-Splitter {
- id: root
- default property alias items: splitterItems.children
- property alias handles: splitterHandles.children
- property Component handleDelegate: Rectangle { width:3; color: "black" }
- property int handleWidth: -1
- property real preferredSize: 0
- property int orientation: Qt.Horizontal
-
- clip: true
- Component.onCompleted: d.init();
- onWidthChanged: d.updateLayout();
- onHeightChanged: d.updateLayout();
-
- QtObject {
- id: d
-
- property bool horizontal: orientation == Qt.Horizontal
- property string size: horizontal ? "width" : "height"
- property string minimum: horizontal ? "minimumWidth" : "minimumHeight"
- property string maximum: horizontal ? "maximumWidth" : "maximumHeight"
-
- property string offset: horizontal ? "x" : "y"
- property int expandingIndex: -1
- property bool updateLayoutGuard: true
- property bool itemWidthGuard: false
- property bool itemExpandingGuard: true
-
- function init()
- {
- for (var i=0; i<items.length; ++i) {
- var item = items[i];
-
- item.Splitter.itemIndex = i
- // Assign one, and only one, item to be expanding:
- if (item.Splitter.expanding === true) {
- if (d.expandingIndex === -1 && item.visible === true)
- d.expandingIndex = i
- else
- item.Splitter.expanding = false
- }
-
- // Anchor each item to fill out all space vertically:
- if (d.horizontal) {
- item.anchors.top = splitterItems.top
- item.anchors.bottom = splitterItems.bottom
- } else {
- item.anchors.left = splitterItems.left
- item.anchors.right = splitterItems.right
-
- }
-
- // Listen for changes to width and expanding:
- propertyChangeListener.createObject(item, {"itemIndex":i});
- if (i < items.length-1) {
- // Create a handle for the item, unless its the last:
- var handle = handleloader.createObject(splitterHandles, {"handleIndex":i});
-
- if (d.horizontal) {
- handle.anchors.top = splitterHandles.top
- handle.anchors.bottom = splitterHandles.bottom
- } else {
- handle.anchors.left = splitterHandles.left
- handle.anchors.right = splitterHandles.right
- }
- }
- }
-
- if (d.expandingIndex === -1) {
- // INVARIANT: No item was set as expanding.
- // We then choose the last visible item instead:
- d.expandingIndex = items.length - 1
- for (i=items.length-1; i>=0; --i) {
- var item = items[i]
- if (item.visible === true) {
- d.expandingIndex = i
- item = items[i]
- break
- }
- }
- if (items.length && item.visible) {
- item.Splitter.expanding = true
- }
- }
-
- d.itemExpandingGuard = false
- d.updateLayoutGuard = false
- d.updateLayout()
- }
-
- function accumulatedSize(firstIndex, lastIndex, includeExpandingMinimum)
- {
- // Go through items and handles, and
- // calculate their acummulated width.
- var w = 0
- for (var i=firstIndex; i<lastIndex; ++i) {
- var item = items[i]
- if (item.visible) {
- if (i !== d.expandingIndex)
- w += item[d.size];
- else if (includeExpandingMinimum && item.Splitter[minimum] != -1)
- w += item.Splitter[minimum]
- }
-
- var handle = handles[i]
- if (handle && items[i + ((d.expandingIndex > i) ? 0 : 1)].visible)
- w += handle[d.size]
- }
- return w
- }
-
- function updateLayout()
- {
- // This function will reposition both handles and
- // items according to the _width of the each item_
- if (items.length === 0)
- return;
- if (d.updateLayoutGuard === true)
- return
- d.updateLayoutGuard = true
-
- // Use a temporary variable to store values to avoid breaking
- // property bindings when the value does not actually change:
- var newValue
-
- // Ensure all items within min/max:
- for (var i=0; i<items.length; ++i) {
- if (i !== d.expandingIndex) {
- item = items[i];
- // If the item is using percentage width, convert
- // that number to real width now:
- if (item.Splitter.percentageSize !== -1) {
- newValue = item.Splitter.percentageSize * (root[d.size] / 100)
- if (newValue !== item[d.size])
- item[d.size] = newValue
- }
- // Ensure item width is not more than maximumSize:
- if (item.Splitter[maximum] !== -1) {
- newValue = Math.min(item[d.size], item.Splitter[maximum])
- if (newValue !== item[d.size])
- item[d.size] = newValue
- }
- // Ensure item width is not more less minimumWidth:
- if (item.Splitter[minimum] !== -1) {
- newValue = Math.max(item[d.size], item.Splitter[minimum])
- if (newValue !== item[d.size])
- item[d.size] = newValue
- }
- }
- }
-
- // Special case: set width of expanding item to available space:
- newValue = root[d.size] - d.accumulatedSize(0, items.length, false);
- var expandingItem = items[d.expandingIndex]
- var expandingMinimum = 0
- if (expandingItem.Splitter[minimum] !== -1)
- expandingMinimum = expandingItem.Splitter[minimum]
- newValue = Math.max(newValue, expandingMinimum)
- if (expandingItem[d.size] !== 0 && expandingItem.Splitter.percentageSize !== -1)
- expandingItem.Splitter.percentageSize = newValue * (100 / root[d.size])
- if (expandingItem[d.size] !== newValue)
- expandingItem[d.size] = newValue
-
- // Then, position items and handles according to their width:
- var item, lastVisibleItem
- var handle, lastVisibleHandle
- var newpreferredSize = expandingMinimum - expandingItem[d.size]
-
- for (i=0; i<items.length; ++i) {
- // Position item to the right of the previous visible handle:
- item = items[i];
- if (item.visible) {
- if (lastVisibleHandle) {
- newValue = lastVisibleHandle[d.offset] + lastVisibleHandle[d.size]
- if (newValue !== item[d.offset])
- item[d.offset] = newValue
- } else {
- newValue = 0
- if (newValue !== item[d.offset])
- item[d.offset] = newValue
- }
- newpreferredSize += item[d.size]
- lastVisibleItem = item
- }
-
- // Position handle to the right of the previous visible item. We use an alterative way of
- // checking handle visibility because that property might not have updated correctly yet:
- handle = handles[i]
- if (handle && items[i + ((d.expandingIndex > i) ? 0 : 1)].visible) {
- newValue = lastVisibleItem[d.offset] + Math.max(0, lastVisibleItem[d.size])
- if (newValue !== handle[d.offset])
- handle[d.offset] = newValue
- newpreferredSize += handle[d.size]
- lastVisibleHandle = handle
- }
- }
-
- root.preferredSize = newpreferredSize
- d.updateLayoutGuard = false
- }
- }
-
- Component {
- id: handleloader
- Loader {
- id: myHandle
- property int handleIndex: 0
- property Item handle: myHandle
- property Item splitterItem: items[handleIndex + ((d.expandingIndex > handleIndex) ? 0 : 1)]
-
- // 'splitterRow' should be an alias, but that fails to resolve runtime:
- property Item splitterRow: root
- property Item background: item
-
- visible: splitterItem.visible
- sourceComponent: handleDelegate
- onWidthChanged: d.updateLayout()
- onHeightChanged: d.updateLayout()
-
- onXChanged: {
- // For some unknown reason, dragging by X axis only not working in MouseArea, so
- // to enable it Drag.XandYAxis should be used, therefore not only Y coordinate
- // changes, but also X and we need to filter out this events, if we have splitter,
- // that should move vertically
- if (d.horizontal) {
- moveHandle()
- }
- }
-
- onYChanged: {
- moveHandle()
- }
-
- function moveHandle() {
- // Moving the handle means resizing an item. Which one,
- // left or right, depends on where the expanding item is.
- // 'updateLayout' will override in case new width violates max/min.
- // And 'updateLayout will be triggered when an item changes width.
- if (d.updateLayoutGuard)
- return
-
- var leftHandle, leftItem, rightItem, rightHandle
- var leftEdge, rightEdge, newWidth, leftStopX, rightStopX
- var i
-
- if (d.expandingIndex > handleIndex) {
- // Resize item to the left.
- // Ensure that the handle is not crossing other handles. So
- // find the first visible handle to the left to determine the left edge:
- leftEdge = 0
- for (i=handleIndex-1; i>=0; --i) {
- leftHandle = handles[i]
- if (leftHandle.visible) {
- leftEdge = leftHandle[d.offset] + leftHandle[d.size]
- break;
- }
- }
-
- // Ensure: leftStopX >= myHandle[d.offset] >= rightStopX
- var min = d.accumulatedSize(handleIndex+1, items.length, true)
- rightStopX = root[d.size] - min - myHandle[d.size]
- leftStopX = Math.max(leftEdge, myHandle[d.offset])
- myHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, myHandle[d.offset]))
-
- newWidth = myHandle[d.offset] - leftEdge
- leftItem = items[handleIndex]
- if (root[d.size] != 0 && leftItem.Splitter.percentageSize !== -1)
- leftItem.Splitter.percentageSize = newWidth * (100 / root[d.size])
- // The next line will trigger 'updateLayout' inside 'propertyChangeListener':
- leftItem[d.size] = newWidth
- } else {
- // Resize item to the right.
- // Ensure that the handle is not crossing other handles. So
- // find the first visible handle to the right to determine the right edge:
- rightEdge = root[d.size]
- for (i=handleIndex+1; i<handles.length; ++i) {
- rightHandle = handles[i]
- if (rightHandle.visible) {
- rightEdge = rightHandle[d.offset]
- break;
- }
- }
-
- // Ensure: leftStopX <= myHandle[d.offset] <= rightStopX
- var min = d.accumulatedSize(0, handleIndex+1, true)
- leftStopX = min - myHandle[d.size]
- rightStopX = Math.min((rightEdge - myHandle[d.size]), myHandle[d.offset])
- myHandle[d.offset] = Math.max(leftStopX, Math.min(myHandle[d.offset], rightStopX))
-
- newWidth = rightEdge - (myHandle[d.offset] + myHandle[d.size])
- rightItem = items[handleIndex+1]
- if (root[d.size] !== 0 && rightItem[d.percentageSize] !== -1)
- rightItem.Splitter.percentageSize = newWidth * (100 / root[d.size])
- // The next line will trigger 'updateLayout' inside 'propertyChangeListener':
- rightItem[d.size] = newWidth
- }
- }
- }
- }
-
- Item {
- id: splitterItems
- anchors.fill: parent
- }
- Item {
- id: splitterHandles
- anchors.fill: parent
- }
-
- Component {
- // This dummy item becomes a child of all
- // items it the splitter, just to provide a way
- // to listen for changes to their width, expanding etc.
- id: propertyChangeListener
- Item {
- id: target
- width: (d.horizontal ? parent[d.size] : 0)
- height: (!d.horizontal ? parent[d.size] : 0)
- property bool expanding: parent.Splitter.expanding
- property real percentageSize: parent.Splitter.percentageSize
- property real minimumWidth: parent.Splitter[d.minimum]
- property real maximumSize: parent.Splitter[d.maximum]
- property int itemIndex: parent.Splitter.itemIndex
-
- onPercentageSizeChanged: d.updateLayout();
- onMinimumWidthChanged: d.updateLayout();
- onMaximumSizeChanged: d.updateLayout();
- onExpandingChanged: updateExpandingIndex()
-
- function updateExpandingIndex()
- {
- // The following code is needed to avoid a binding
- // loop, since we might change 'expanding' again to a different item:
- if (d.itemExpandingGuard === true)
- return
- d.itemExpandingGuard = true
- // break binding:
- expanding = false
-
- // 'expanding' follows radio button behavior:
- // First, find the new expanding item:
- var newIndex = items.length-1
- for (var i=0; i<items.length; ++i) {
- var item = items[i]
- if (i !== d.expandingIndex && item.Splitter.expanding === true && item.visible === true) {
- newIndex = i
- break
- }
- }
- item = items[newIndex]
- if (item.visible === false) {
- // So now we ended up with the last item in the splitter to be
- // expanding, but it turns out to not be visible. So we need to
- // traverse backwards again to find one that is visible...
- for (i=items.length-2; i>=0; --i) {
- var item = items[i]
- if (item.visible === true) {
- newIndex = i
- item = items[newIndex]
- break
- }
- }
- }
-
- // Tell the found item that it is expanding:
- if (item.Splitter.expanding !== true)
- item.Splitter.expanding = true
- // ...and the old one that it is not:
- if (newIndex !== d.expandingIndex) {
- item = items[d.expandingIndex]
- if (item.Splitter.expanding !== false)
- item.Splitter.expanding = false
- }
- // update index:
- d.expandingIndex = newIndex
- d.updateLayout();
- // recreate binding:
- expanding = Qt.binding(function() { return parent.Splitter.expanding })
- d.itemExpandingGuard = false
- }
-
- function handleSizeChanged() {
- // We need to update the layout.
- // The following code is needed to avoid a binding
- // loop, since we might change 'width' again to a different value:
- if (d.itemWidthGuard === true)
- return
- d.itemWidthGuard = true
- // Break binding:
- if (d.horizontal) {
- width = 0
- } else {
- height = 0
- }
-
- d.updateLayout()
-
- // Restablish binding:
- if (d.horizontal) {
- width = Qt.binding(function() { return parent[d.size]; })
- } else {
- height = Qt.binding(function() { return parent[d.size]; })
- }
- d.itemWidthGuard = false
- }
-
- onWidthChanged: handleSizeChanged()
- onHeightChanged: handleSizeChanged()
- onVisibleChanged: {
- // Hiding the expanding item forces us to
- // select a new one (and therefore not recommended):
- if (d.expandingIndex === itemIndex) {
- updateExpandingIndex()
- } else {
- if (visible) {
- // Try to keep all items within the SplitterRow. When an item
- // has been hidden, the expanding item might no longer be large enough
- // to give away space to the new items width. So we need to resize:
- var overflow = d.accumulatedSize(0, items.length, true) - root[d.size];
- if (overflow > 0)
- parent[d.size] -= overflow
- }
- d.updateLayout()
- }
- }
- }
- }
-}
diff --git a/src/qtdesktop/private/TabBar.qml b/src/qtdesktop/private/TabBar.qml
deleted file mode 100644
index 68233ff6..00000000
--- a/src/qtdesktop/private/TabBar.qml
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Components project.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtDesktop 1.0
-
-Item {
- id: tabbar
- height: tabrow.height
- width: tabrow.width
-
-
- Keys.onRightPressed: {
- if (tabFrame && tabFrame.current < tabFrame.count - 1)
- tabFrame.current = tabFrame.current + 1
- }
- Keys.onLeftPressed: {
- if (tabFrame && tabFrame.current > 0)
- tabFrame.current = tabFrame.current - 1
- }
-
- onTabFrameChanged: parent = tabFrame
- visible: tabFrame ? tabFrame.tabsVisible : true
-
-
- property Item tabFrame
- property var style
- property var styleItem: tabFrame.__styleItem ? tabFrame.__styleItem : null
-
- property string tabBarAlignment: styleItem ? styleItem.tabBarAlignment : "left"
- property string position: tabFrame ? tabFrame.position : "North"
-
- property int tabOverlap: styleItem ? styleItem.tabOverlap : 0
- property int tabBaseOverlap: styleItem ? styleItem.tabBaseOverlap : 0
-
- function tab(index) {
- for (var i = 0; i < tabrow.children.length; ++i) {
- if (tabrow.children[i].tabindex == index) {
- return tabrow.children[i]
- }
- }
- return null;
- }
-
- Row {
- id: tabrow
- Accessible.role: Accessible.PageTabList
- spacing: -tabOverlap
-
- states: [
- State {
- name: "left"
- AnchorChanges { target:tabrow ; anchors.left: parent.left }
- PropertyChanges { target:tabrow ; anchors.leftMargin: styleItem ? styleItem.leftMargin : 0 }
- },
- State {
- name: "center"
- when: tabBarAlignment == "center"
- AnchorChanges { target:tabrow ; anchors.horizontalCenter: tabbar.horizontalCenter }
- },
- State {
- name: "right"
- when: tabBarAlignment == "right"
- AnchorChanges { target:tabrow ; anchors.right: parent.right }
- PropertyChanges { target:tabrow ; anchors.rightMargin: styleItem ? styleItem.rightMargin : 0 }
- }
- ]
-
-
- Repeater {
- id: repeater
- focus: true
- model: tabFrame ? tabFrame.tabs.length : null
- delegate: Item {
- id: tabitem
- focus: true
-
- property int tabindex: index
- property bool selectedHelper: selected
- property bool selected : tabFrame.current == index
- property bool hover: mousearea.containsMouse
- property bool first: index === 0
- property string title: tabFrame.tabs[index].title
-
- z: selected ? 1 : -index
- implicitWidth: Math.min(tabloader.implicitWidth, tabbar.width/tabs.length) + 1
- implicitHeight: tabloader.implicitHeight
-
- Loader {
- id: tabloader
-
- sourceComponent: loader.item ? loader.item.tab : null
- anchors.fill: parent
-
- property Item control: tabFrame
- property Item tab: tabitem
- property int index: tabindex
- property bool nextSelected: tabFrame.current === index + 1
- property bool previousSelected: tabFrame.current === index - 1
- property string title: tab.title
- }
-
- MouseArea {
- id: mousearea
- anchors.fill: parent
- hoverEnabled: true
- onPressed: tabFrame.current = index
- onPressAndHold: tabitem.parent = null
- }
- Accessible.role: Accessible.PageTab
- Accessible.name: tabFrame.tabs[index].title
- }
- }
- }
-}