summaryrefslogtreecommitdiff
path: root/src/controls/Styles/Android
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-27 10:26:23 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-08-07 21:40:40 +0200
commitb4faa9e17d51182f15911de5d9cd811a28d096b0 (patch)
tree4250c9ef10eb4d1c416563f99bd048a5d6c461de /src/controls/Styles/Android
parent6b8a0dabdc750052512446ee6db06d4033320d48 (diff)
downloadqtquickcontrols-b4faa9e17d51182f15911de5d9cd811a28d096b0.tar.gz
Android style
Note: Requires Android 3.0 (API level 11) or later. Task-number: QTBUG-35081 Change-Id: Id7a4577a4d78c9474c9ccd7ae754e16fcac8f0e5 Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'src/controls/Styles/Android')
-rw-r--r--src/controls/Styles/Android/Android.pro56
-rw-r--r--src/controls/Styles/Android/AndroidStyle.qml47
-rw-r--r--src/controls/Styles/Android/ApplicationWindowStyle.qml54
-rw-r--r--src/controls/Styles/Android/BusyIndicatorStyle.qml77
-rw-r--r--src/controls/Styles/Android/ButtonStyle.qml106
-rw-r--r--src/controls/Styles/Android/CalendarStyle.qml155
-rw-r--r--src/controls/Styles/Android/CheckBoxStyle.qml84
-rw-r--r--src/controls/Styles/Android/ComboBoxStyle.qml115
-rw-r--r--src/controls/Styles/Android/CursorHandleStyle.qml110
-rw-r--r--src/controls/Styles/Android/FocusFrameStyle.qml44
-rw-r--r--src/controls/Styles/Android/GroupBoxStyle.qml121
-rw-r--r--src/controls/Styles/Android/LabelStyle.qml116
-rw-r--r--src/controls/Styles/Android/MenuBarStyle.qml42
-rw-r--r--src/controls/Styles/Android/MenuStyle.qml42
-rw-r--r--src/controls/Styles/Android/ProgressBarStyle.qml80
-rw-r--r--src/controls/Styles/Android/RadioButtonStyle.qml84
-rw-r--r--src/controls/Styles/Android/ScrollViewStyle.qml87
-rw-r--r--src/controls/Styles/Android/SliderStyle.qml93
-rw-r--r--src/controls/Styles/Android/SpinBoxStyle.qml108
-rw-r--r--src/controls/Styles/Android/StatusBarStyle.qml58
-rw-r--r--src/controls/Styles/Android/SwitchStyle.qml129
-rw-r--r--src/controls/Styles/Android/TabViewStyle.qml132
-rw-r--r--src/controls/Styles/Android/TableViewStyle.qml114
-rw-r--r--src/controls/Styles/Android/TextAreaStyle.qml82
-rw-r--r--src/controls/Styles/Android/TextFieldStyle.qml101
-rw-r--r--src/controls/Styles/Android/ToolBarStyle.qml77
-rw-r--r--src/controls/Styles/Android/ToolButtonStyle.qml119
-rw-r--r--src/controls/Styles/Android/drawables/AnimationDrawable.qml82
-rw-r--r--src/controls/Styles/Android/drawables/ClipDrawable.qml76
-rw-r--r--src/controls/Styles/Android/drawables/ColorDrawable.qml51
-rw-r--r--src/controls/Styles/Android/drawables/Drawable.qml75
-rw-r--r--src/controls/Styles/Android/drawables/DrawableLoader.qml102
-rw-r--r--src/controls/Styles/Android/drawables/GradientDrawable.qml76
-rw-r--r--src/controls/Styles/Android/drawables/ImageDrawable.qml56
-rw-r--r--src/controls/Styles/Android/drawables/LayerDrawable.qml75
-rw-r--r--src/controls/Styles/Android/drawables/NinePatchDrawable.qml63
-rw-r--r--src/controls/Styles/Android/drawables/RotateDrawable.qml80
-rw-r--r--src/controls/Styles/Android/drawables/StateDrawable.qml105
-rw-r--r--src/controls/Styles/Android/plugin.cpp68
-rw-r--r--src/controls/Styles/Android/qmldir4
-rw-r--r--src/controls/Styles/Android/qquickandroid9patch.cpp297
-rw-r--r--src/controls/Styles/Android/qquickandroid9patch_p.h112
-rw-r--r--src/controls/Styles/Android/qquickandroidstyle.cpp102
-rw-r--r--src/controls/Styles/Android/qquickandroidstyle_p.h101
44 files changed, 3958 insertions, 0 deletions
diff --git a/src/controls/Styles/Android/Android.pro b/src/controls/Styles/Android/Android.pro
new file mode 100644
index 00000000..64b76a65
--- /dev/null
+++ b/src/controls/Styles/Android/Android.pro
@@ -0,0 +1,56 @@
+TARGET = qtquickcontrolsandroidstyleplugin
+TARGETPATH = QtQuick/Controls/Styles/Android
+IMPORT_VERSION = 1.0
+
+QT += qml quick quick-private gui-private core-private
+
+QML_FILES += \
+ $$PWD/AndroidStyle.qml \
+ $$PWD/ApplicationWindowStyle.qml \
+ $$PWD/ButtonStyle.qml \
+ $$PWD/BusyIndicatorStyle.qml \
+ $$PWD/CalendarStyle.qml \
+ $$PWD/CheckBoxStyle.qml \
+ $$PWD/ComboBoxStyle.qml \
+ $$PWD/CursorHandleStyle.qml \
+ $$PWD/FocusFrameStyle.qml \
+ $$PWD/GroupBoxStyle.qml \
+ $$PWD/LabelStyle.qml \
+ $$PWD/MenuBarStyle.qml \
+ $$PWD/MenuStyle.qml \
+ $$PWD/ProgressBarStyle.qml \
+ $$PWD/RadioButtonStyle.qml \
+ $$PWD/ScrollViewStyle.qml\
+ $$PWD/SliderStyle.qml \
+ $$PWD/SpinBoxStyle.qml \
+ $$PWD/SwitchStyle.qml \
+ $$PWD/StatusBarStyle.qml \
+ $$PWD/TableViewStyle.qml \
+ $$PWD/TabViewStyle.qml \
+ $$PWD/TextAreaStyle.qml \
+ $$PWD/TextFieldStyle.qml \
+ $$PWD/ToolBarStyle.qml \
+ $$PWD/ToolButtonStyle.qml \
+ $$PWD/drawables/Drawable.qml \
+ $$PWD/drawables/DrawableLoader.qml \
+ $$PWD/drawables/AnimationDrawable.qml \
+ $$PWD/drawables/ClipDrawable.qml \
+ $$PWD/drawables/ColorDrawable.qml \
+ $$PWD/drawables/GradientDrawable.qml \
+ $$PWD/drawables/ImageDrawable.qml \
+ $$PWD/drawables/LayerDrawable.qml \
+ $$PWD/drawables/NinePatchDrawable.qml \
+ $$PWD/drawables/RotateDrawable.qml \
+ $$PWD/drawables/StateDrawable.qml
+
+HEADERS += \
+ $$PWD/qquickandroid9patch_p.h \
+ $$PWD/qquickandroidstyle_p.h
+
+SOURCES += \
+ $$PWD/plugin.cpp \
+ $$PWD/qquickandroid9patch.cpp \
+ $$PWD/qquickandroidstyle.cpp
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/controls/Styles/Android/AndroidStyle.qml b/src/controls/Styles/Android/AndroidStyle.qml
new file mode 100644
index 00000000..065f572e
--- /dev/null
+++ b/src/controls/Styles/Android/AndroidStyle.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQml 2.0
+import QtQuick.Controls.Styles.Android 1.0
+
+AndroidStyleBase {
+ readonly property var styleDef: JSON.parse(data)
+}
diff --git a/src/controls/Styles/Android/ApplicationWindowStyle.qml b/src/controls/Styles/Android/ApplicationWindowStyle.qml
new file mode 100644
index 00000000..32c1efbd
--- /dev/null
+++ b/src/controls/Styles/Android/ApplicationWindowStyle.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+QtObject {
+ readonly property ApplicationWindow control: __control
+
+ property Component background: DrawableLoader {
+ accelerated: true
+ visible: !styleData.hasColor
+ window_focused: control.active
+ styleDef: AndroidStyle.styleDef.windowStyle.Window_windowBackground
+ }
+}
diff --git a/src/controls/Styles/Android/BusyIndicatorStyle.qml b/src/controls/Styles/Android/BusyIndicatorStyle.qml
new file mode 100644
index 00000000..271e4b20
--- /dev/null
+++ b/src/controls/Styles/Android/BusyIndicatorStyle.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property BusyIndicator control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: resolveStyle()
+
+ function resolveStyle() {
+ var size = control.styleHints ? control.styleHints['size'] : undefined
+ if (size === "small" || !size && control.width > 0 && control.width < AndroidStyle.styleDef.progressBarStyle.ProgressBar_minWidth)
+ return AndroidStyle.styleDef.progressBarStyleSmall
+ if (size === "large" || !size && control.width >= AndroidStyle.styleDef.progressBarStyleLarge.ProgressBar_minWidth)
+ return AndroidStyle.styleDef.progressBarStyleLarge
+ return AndroidStyle.styleDef.progressBarStyle
+ }
+
+ readonly property real minWidth: styleDef.ProgressBar_minWidth || styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.ProgressBar_minHeight || styleDef.View_minHeight || 0
+
+ anchors.centerIn: parent
+ implicitWidth: Math.max(minWidth, bg.implicitWidth)
+ implicitHeight: Math.max(minHeight, bg.implicitHeight)
+
+ DrawableLoader {
+ id: bg
+ visible: control.running
+ duration: panel.styleDef.ProgressBar_indeterminateDuration
+ styleDef: panel.styleDef.ProgressBar_indeterminateDrawable
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/ButtonStyle.qml b/src/controls/Styles/Android/ButtonStyle.qml
new file mode 100644
index 00000000..619b5eff
--- /dev/null
+++ b/src/controls/Styles/Android/ButtonStyle.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property Button control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: control.checkable ? AndroidStyle.styleDef.buttonStyleToggle
+ : AndroidStyle.styleDef.buttonStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+ readonly property real contentWidth: row.implicitWidth + bg.padding.left + bg.padding.right
+ readonly property real contentHeight: row.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+
+ implicitWidth: Math.max(minWidth, Math.max(bg.implicitWidth, contentWidth))
+ implicitHeight: Math.max(minHeight, Math.max(bg.implicitHeight, contentHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.View_background
+ }
+
+ RowLayout {
+ id: row
+ anchors.fill: parent
+ anchors.topMargin: bg.padding.top
+ anchors.leftMargin: bg.padding.left
+ anchors.rightMargin: bg.padding.right
+ anchors.bottomMargin: bg.padding.bottom
+ spacing: Math.max(bg.padding.left, bg.padding.right)
+
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ Layout.alignment: Qt.AlignCenter
+ }
+
+ LabelStyle {
+ id: label
+ visible: !!text
+ text: control.text
+ pressed: control.pressed
+ focused: control.activeFocus
+ selected: control.checked
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef
+ Layout.fillWidth: true
+ }
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/CalendarStyle.qml b/src/controls/Styles/Android/CalendarStyle.qml
new file mode 100644
index 00000000..7d872ed8
--- /dev/null
+++ b/src/controls/Styles/Android/CalendarStyle.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+CalendarStyle {
+ gridColor: "transparent"
+ __verticalSeparatorColor: "transparent"
+ __horizontalSeparatorColor: AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.CalendarView_weekSeparatorLineColor)
+
+ background: Rectangle {
+ implicitWidth: Screen.width * 0.8
+ implicitHeight: Screen.height * 0.8
+ color: AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.defaultBackgroundColor)
+ }
+
+ navigationBar: Row {
+ ToolButton {
+ id: prevButton
+ text: "\u25c0" // BLACK LEFT-POINTING TRIANGLE
+ onClicked: control.showPreviousMonth()
+ }
+ LabelStyle {
+ id: navigationBar
+ text: styleData.title
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.calendarViewStyle
+ width: parent.width - prevButton.width - nextButton.width
+ height: parent.height
+ }
+ ToolButton {
+ id: nextButton
+ text: "\u25b6" // BLACK RIGHT-POINTING TRIANGLE
+ onClicked: control.showNextMonth()
+ }
+ }
+
+ dayOfWeekDelegate: Item {
+ implicitWidth: dayOfWeek.implicitWidth * 2
+ implicitHeight: dayOfWeek.implicitHeight * 2
+ LabelStyle {
+ id: dayOfWeek
+ anchors.centerIn: parent
+ text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat)
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.calendarViewStyle.CalendarView_weekDayTextAppearance
+ }
+ }
+
+ weekNumberDelegate: Item {
+ implicitWidth: weekNumber.implicitWidth * 2
+ implicitHeight: weekNumber.implicitHeight * 2
+ LabelStyle {
+ id: weekNumber
+ anchors.centerIn: parent
+ text: styleData.weekNumber
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.calendarViewStyle
+ color: AndroidStyle.colorValue(styleDef.CalendarView_weekNumberColor)
+ }
+ }
+
+ dayDelegate: Rectangle {
+ readonly property int row: styleData.index / 7
+ readonly property int selectedRow: control.__model.indexAt(control.selectedDate) / 7
+
+ anchors.fill: parent
+ anchors.rightMargin: -1
+ color: styleData.selected || row !== selectedRow ? "transparent" :
+ AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.CalendarView_selectedWeekBackgroundColor)
+
+ DrawableLoader {
+ height: parent.height
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ active: styleData.selected
+ styleDef: AndroidStyle.styleDef.calendarViewStyle.CalendarView_selectedDateVerticalBar
+ width: 6 // UNSCALED_SELECTED_DATE_VERTICAL_BAR_WIDTH
+ }
+
+ DrawableLoader {
+ height: parent.height
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ anchors.right: parent.right
+ active: styleData.selected
+ styleDef: AndroidStyle.styleDef.calendarViewStyle.CalendarView_selectedDateVerticalBar
+ width: 6 // UNSCALED_SELECTED_DATE_VERTICAL_BAR_WIDTH
+ }
+
+ LabelStyle {
+ anchors.centerIn: parent
+ text: styleData.date.getDate()
+ enabled: styleData.valid
+ pressed: styleData.pressed
+ selected: styleData.selected
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.calendarViewStyle.CalendarView_dateTextAppearance
+ color: styleData.valid && styleData.visibleMonth ? AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.CalendarView_focusedMonthDateColor)
+ : AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.CalendarView_unfocusedMonthDateColor)
+ }
+
+ Rectangle {
+ visible: row > 0
+ width: parent.width
+ height: 1 // UNSCALED_WEEK_SEPARATOR_LINE_WIDTH
+ color: AndroidStyle.colorValue(AndroidStyle.styleDef.calendarViewStyle.CalendarView_weekSeparatorLineColor)
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/CheckBoxStyle.qml b/src/controls/Styles/Android/CheckBoxStyle.qml
new file mode 100644
index 00000000..9abe76d0
--- /dev/null
+++ b/src/controls/Styles/Android/CheckBoxStyle.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property CheckBox control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.checkboxStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+
+ implicitWidth: Math.max(minWidth, indicator.implicitWidth + label.implicitWidth)
+ implicitHeight: Math.max(minHeight, Math.max(indicator.implicitHeight, label.implicitHeight))
+
+ DrawableLoader {
+ id: indicator
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.CompoundButton_button
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ LabelStyle {
+ id: label
+ text: control.text
+ pressed: control.pressed
+ focused: control.activeFocus
+ selected: control.checked
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef
+
+ anchors.fill: parent
+ anchors.leftMargin: indicator.width // TODO: spacing
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/ComboBoxStyle.qml b/src/controls/Styles/Android/ComboBoxStyle.qml
new file mode 100644
index 00000000..025231c4
--- /dev/null
+++ b/src/controls/Styles/Android/ComboBoxStyle.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ id: style
+
+ readonly property ComboBox control: __control
+ property int renderType: Text.QtRendering
+
+ padding.left: control.__panel.paddingStart
+
+ property Component panel: Item {
+ id: panel
+
+ property bool popup: false
+ property int dropDownButtonWidth: paddingEnd * 2 // TODO
+ property alias textColor: label.color
+ property alias selectionColor: label.selectionColor
+ property alias selectedTextColor: label.selectedTextColor
+ property alias font: label.font
+
+ readonly property var styleDef: AndroidStyle.styleDef.spinnerStyle
+ readonly property var itemDef: AndroidStyle.styleDef.simple_spinner_item
+
+ readonly property real paddingStart: (itemDef.View_paddingStart || itemDef.View_paddingLeft || 0) + bg.padding.left
+ readonly property real paddingEnd: (itemDef.View_paddingEnd || itemDef.View_paddingRight || 0) + bg.padding.right
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+ readonly property real labelWidth: label.implicitWidth + paddingStart + paddingEnd
+ readonly property real labelHeight: label.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ implicitWidth: Math.max(minWidth, Math.max(bg.implicitWidth, labelWidth))
+ implicitHeight: Math.max(minHeight, Math.max(bg.implicitHeight, labelHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ pressed: control.pressed
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.View_background
+ }
+
+ LabelStyle {
+ id: label
+ text: control.currentText
+ visible: !control.editable
+ pressed: control.pressed
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef
+
+ anchors.fill: bg
+ anchors.topMargin: bg.padding.top
+ anchors.leftMargin: paddingStart
+ anchors.rightMargin: paddingEnd
+ anchors.bottomMargin: bg.padding.bottom
+ }
+ }
+
+ property Component __popupStyle: null
+ property Component __dropDownStyle: null
+
+ property Component selectionHandle: DrawableLoader {
+ styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
+ x: -width / 4 * 3
+ y: styleData.lineHeight
+ }
+
+ property Component cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/controls/Styles/Android/CursorHandleStyle.qml b/src/controls/Styles/Android/CursorHandleStyle.qml
new file mode 100644
index 00000000..8f1cff4f
--- /dev/null
+++ b/src/controls/Styles/Android/CursorHandleStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+DrawableLoader {
+ id: delegate
+ property bool active: false
+ styleDef: styleData.hasSelection ? AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleRight
+ : AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandle
+ x: styleData.hasSelection ? -width / 4 : -width / 2
+ y: styleData.lineHeight
+ opacity: 1.0
+
+ pressed: styleData.pressed
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+
+ Connections {
+ target: editor
+ ignoreUnknownSignals: true
+ onDisplayTextChanged: {
+ delegate.state = "hidden"
+ }
+ }
+
+ Connections {
+ target: styleData
+ onActivated: {
+ if (editor.text) {
+ delegate.active = true
+ delegate.opacity = 1.0
+ delegate.state = ""
+ if (!styleData.hasSelection)
+ delegate.state = "idle"
+ }
+ }
+ }
+
+ state: "hidden"
+
+ states: [
+ State {
+ name: "hidden"
+ when: editor.inputMethodComposing && !delegate.active && !editor.text
+ },
+ State {
+ name: "idle"
+ when: !styleData.hasSelection && !styleData.pressed
+ }
+ ]
+
+ transitions: [
+ Transition {
+ to: "hidden"
+ SequentialAnimation {
+ PauseAnimation { duration: 100 }
+ PropertyAction { target: delegate; property: "opacity"; value: 0.0 }
+ }
+ },
+ Transition {
+ to: "idle"
+ SequentialAnimation {
+ PauseAnimation { duration: 4000 }
+ NumberAnimation { target: delegate; property: "opacity"; to: 0.0 }
+ PropertyAction { target: delegate; property: "active"; value: false }
+ }
+ }
+ ]
+}
diff --git a/src/controls/Styles/Android/FocusFrameStyle.qml b/src/controls/Styles/Android/FocusFrameStyle.qml
new file mode 100644
index 00000000..f63f0db3
--- /dev/null
+++ b/src/controls/Styles/Android/FocusFrameStyle.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Item {
+ property int margin: 0
+}
diff --git a/src/controls/Styles/Android/GroupBoxStyle.qml b/src/controls/Styles/Android/GroupBoxStyle.qml
new file mode 100644
index 00000000..d974635e
--- /dev/null
+++ b/src/controls/Styles/Android/GroupBoxStyle.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+GroupBoxStyle {
+ id: root
+
+ panel: Item {
+ anchors.fill: parent
+
+ readonly property var styleDef: AndroidStyle.styleDef.checkboxStyle
+
+ readonly property real contentMargin: label.implicitHeight / 3
+ readonly property real topMargin: indicator.height
+ Binding { target: root; property: "padding.top"; value: topMargin + contentMargin }
+ Binding { target: root; property: "padding.left"; value: contentMargin }
+ Binding { target: root; property: "padding.right"; value: contentMargin }
+ Binding { target: root; property: "padding.bottom"; value: contentMargin }
+
+ DrawableLoader {
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.topMargin: topMargin
+ styleDef: AndroidStyle.styleDef.actionBarStyle.ActionBar_divider
+ }
+
+ DrawableLoader {
+ active: !control.flat
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.topMargin: topMargin
+ styleDef: AndroidStyle.styleDef.actionBarStyle.ActionBar_divider
+ }
+
+ DrawableLoader {
+ active: !control.flat
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.topMargin: topMargin
+ styleDef: AndroidStyle.styleDef.actionBarStyle.ActionBar_divider
+ }
+
+ DrawableLoader {
+ active: !control.flat
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ styleDef: AndroidStyle.styleDef.actionBarStyle.ActionBar_divider
+ }
+
+ DrawableLoader {
+ id: indicator
+ visible: control.checkable
+ checked: control.checked
+ pressed: check.pressed
+ focused: check.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.checkboxStyle.CompoundButton_button
+ anchors.verticalCenter: label.verticalCenter
+ width: control.checkable ? item.implicitWidth : 0
+ }
+
+ LabelStyle {
+ id: label
+ text: control.title
+ pressed: check.pressed
+ selected: control.checked
+ focused: check.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.checkboxStyle
+
+ anchors.top: parent.top
+ anchors.left: indicator.right
+ anchors.right: parent.right
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/LabelStyle.qml b/src/controls/Styles/Android/LabelStyle.qml
new file mode 100644
index 00000000..61bad1cf
--- /dev/null
+++ b/src/controls/Styles/Android/LabelStyle.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+
+Text {
+ id: root
+
+ property var styleDef
+
+ property bool pressed
+ property bool focused
+ property bool selected
+ property bool window_focused
+
+ readonly property string key: {
+ var states = []
+ if (pressed) states.push("PRESSED")
+ if (enabled) states.push("ENABLED")
+ if (focused) states.push("FOCUSED")
+ if (selected) states.push("SELECTED")
+ if (window_focused) states.push("WINDOW_FOCUSED")
+ if (!states.length)
+ states.push("EMPTY")
+ return states.join("_") + "_STATE_SET"
+ }
+
+ readonly property string selection: {
+ var states = []
+ if (pressed) states.push("PRESSED")
+ if (enabled) states.push("ENABLED")
+ if (focused) states.push("FOCUSED")
+ states.push("SELECTED")
+ if (window_focused) states.push("WINDOW_FOCUSED")
+ return states.join("_") + "_STATE_SET"
+ }
+
+ readonly property int textStyleBold: 1
+ readonly property int textStyleItalic: 2
+
+ readonly property int ellipsizeStart: 1
+ readonly property int ellipsizeMiddle: 2
+ readonly property int ellipsizeEnd: 3
+ readonly property int ellipsizeMarquee: 4
+
+ // TODO: font.styleHint
+ readonly property int typefaceSans: 1
+ readonly property int typefaceSerif: 2
+ readonly property int typefaceMonospace: 3
+
+ color: AndroidStyle.colorValue(styleDef.TextAppearance_textColor[key]) ||
+ AndroidStyle.colorValue(styleDef.defaultTextColorPrimary)
+ linkColor: AndroidStyle.colorValue(styleDef.TextAppearance_textColorLink[key])
+ readonly property color hintColor: AndroidStyle.colorValue(styleDef.TextAppearance_textColorHint[key])
+ readonly property color selectionColor: AndroidStyle.colorValue(styleDef.TextAppearance_textColorHighlight)
+ readonly property color selectedTextColor: AndroidStyle.colorValue(styleDef.TextAppearance_textColor[selection])
+
+ font.pixelSize: styleDef.TextAppearance_textSize
+ font.bold: styleDef.TextAppearance_textStyle & textStyleBold
+ font.italic: styleDef.TextAppearance_textStyle & textStyleItalic
+ font.capitalization: styleDef.TextAppearance_textAllCaps ? Font.AllUppercase : Font.MixedCase
+
+ maximumLineCount: styleDef.TextView_maxLines || Number.MAX_VALUE
+
+ readonly property int ellipsize: styleDef.TextView_ellipsize || 0
+ elide: ellipsize === ellipsizeMarquee ? Text.ElideRight : // TODO: marquee
+ ellipsize === ellipsizeMiddle ? Text.ElideMiddle :
+ ellipsize === ellipsizeStart ? Text.ElideLeft : Text.ElideRight
+
+ readonly property int horizontalGravity: (styleDef.TextView_gravity || 0) & AndroidStyleBase.HORIZONTAL_GRAVITY_MASK
+ horizontalAlignment: horizontalGravity == AndroidStyleBase.LEFT ? Qt.AlignLeft :
+ horizontalGravity == AndroidStyleBase.RIGHT ? Qt.AlignRight : Qt.AlignHCenter
+
+ readonly property int verticalGravity: (styleDef.TextView_gravity || 0) & AndroidStyleBase.VERTICAL_GRAVITY_MASK
+ verticalAlignment: verticalGravity == AndroidStyleBase.TOP ? Qt.AlignTop :
+ verticalGravity == AndroidStyleBase.BOTTOM ? Qt.AlignBottom : Qt.AlignVCenter
+}
diff --git a/src/controls/Styles/Android/MenuBarStyle.qml b/src/controls/Styles/Android/MenuBarStyle.qml
new file mode 100644
index 00000000..574b4b06
--- /dev/null
+++ b/src/controls/Styles/Android/MenuBarStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.Controls.Styles 1.2
+
+MenuBarStyle { }
diff --git a/src/controls/Styles/Android/MenuStyle.qml b/src/controls/Styles/Android/MenuStyle.qml
new file mode 100644
index 00000000..08383a98
--- /dev/null
+++ b/src/controls/Styles/Android/MenuStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.Controls.Styles 1.2
+
+MenuStyle { }
diff --git a/src/controls/Styles/Android/ProgressBarStyle.qml b/src/controls/Styles/Android/ProgressBarStyle.qml
new file mode 100644
index 00000000..57e2f4ca
--- /dev/null
+++ b/src/controls/Styles/Android/ProgressBarStyle.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property ProgressBar control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ readonly property var styleDef: AndroidStyle.styleDef.progressBarStyleHorizontal
+
+ readonly property real minWidth: styleDef.ProgressBar_minWidth || 0
+ readonly property real minHeight: styleDef.ProgressBar_minHeight || 0
+ readonly property real maxWidth: styleDef.ProgressBar_maxWidth || minWidth
+ readonly property real maxHeight: styleDef.ProgressBar_maxHeight || minHeight
+
+ readonly property real preferredWidth: Math.min(maxWidth, Math.max(minWidth, bg.implicitWidth))
+ readonly property real preferredHeight: Math.min(maxHeight, Math.max(minHeight, bg.implicitHeight))
+
+ implicitWidth: horizontal ? preferredWidth : preferredHeight
+ implicitHeight: horizontal ? preferredHeight : preferredWidth
+
+ DrawableLoader {
+ id: bg
+ width: horizontal ? parent.width : parent.height
+ height: !horizontal ? parent.width : parent.height
+ y: horizontal ? 0 : width
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+ styleDef: control.indeterminate ? panel.styleDef.ProgressBar_indeterminateDrawable
+ : panel.styleDef.ProgressBar_progressDrawable
+ level: (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue)
+ levelId: panel.styleDef.ProgressBar_progress_id
+ excludes: [panel.styleDef.ProgressBar_secondaryProgress_id]
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/RadioButtonStyle.qml b/src/controls/Styles/Android/RadioButtonStyle.qml
new file mode 100644
index 00000000..b8447ad6
--- /dev/null
+++ b/src/controls/Styles/Android/RadioButtonStyle.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property RadioButton control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.radioButtonStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+
+ implicitWidth: Math.max(minWidth, indicator.implicitWidth + label.implicitWidth)
+ implicitHeight: Math.max(minHeight, Math.max(indicator.implicitHeight, label.implicitHeight))
+
+ DrawableLoader {
+ id: indicator
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.CompoundButton_button
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ LabelStyle {
+ id: label
+ text: control.text
+ pressed: control.pressed
+ focused: control.activeFocus
+ selected: control.checked
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef
+
+ anchors.fill: parent
+ anchors.leftMargin: indicator.width // TODO: spacing
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/ScrollViewStyle.qml b/src/controls/Styles/Android/ScrollViewStyle.qml
new file mode 100644
index 00000000..0105b9cb
--- /dev/null
+++ b/src/controls/Styles/Android/ScrollViewStyle.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+ScrollViewStyle {
+ handleOverlap: 0
+ transientScrollBars: true
+ minimumHandleLength: AndroidStyle.styleDef.scrollViewStyle.View_scrollbarSize
+
+ __scrollBarFadeDelay: AndroidStyle.styleDef.scrollViewStyle.View_scrollbarDefaultDelayBeforeFade || 300
+ __scrollBarFadeDuration: AndroidStyle.styleDef.scrollViewStyle.View_scrollbarFadeDuration || 250
+
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+
+ corner: null
+ incrementControl: null
+ decrementControl: null
+
+ frame: DrawableLoader {
+ active: control.frameVisible
+ visible: !!control["backgroundVisible"]
+ styleDef: AndroidStyle.styleDef.scrollViewStyle.View_background
+ }
+
+ scrollBarBackground: Item {
+ implicitWidth: Math.max(minimumHandleLength, track.implicitWidth)
+ implicitHeight: Math.max(minimumHandleLength, track.implicitHeight)
+ DrawableLoader {
+ id: track
+ styleDef: styleData.horizontal ? AndroidStyle.styleDef.scrollViewStyle.View_scrollbarTrackHorizontal
+ : AndroidStyle.styleDef.scrollViewStyle.View_scrollbarTrackVertical
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ }
+ }
+
+ handle: DrawableLoader {
+ styleDef: styleData.horizontal ? AndroidStyle.styleDef.scrollViewStyle.View_scrollbarThumbHorizontal
+ : AndroidStyle.styleDef.scrollViewStyle.View_scrollbarThumbVertical
+ pressed: styleData.pressed
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ }
+}
diff --git a/src/controls/Styles/Android/SliderStyle.qml b/src/controls/Styles/Android/SliderStyle.qml
new file mode 100644
index 00000000..cca43143
--- /dev/null
+++ b/src/controls/Styles/Android/SliderStyle.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property Slider control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ readonly property var styleDef: AndroidStyle.styleDef.seekBarStyle
+
+ readonly property real thumbOffset: styleDef.thumbOffset || thumb.implicitWidth / 2
+
+ readonly property real minWidth: styleDef.ProgressBar_minWidth || styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.ProgressBar_minHeight || styleDef.View_minHeight || 0
+
+ readonly property real preferredWidth: Math.max(minWidth, track.implicitWidth)
+ readonly property real preferredHeight: Math.max(minHeight, Math.max(thumb.implicitHeight, track.implicitHeight))
+
+ implicitWidth: horizontal ? preferredWidth : preferredHeight
+ implicitHeight: horizontal ? preferredHeight : preferredWidth
+
+ y: horizontal ? 0 : height
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+
+ Item {
+ anchors.fill: parent
+ DrawableLoader {
+ id: track
+ styleDef: panel.styleDef.ProgressBar_progressDrawable
+ level: (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue)
+ excludes: [panel.styleDef.ProgressBar_secondaryProgress_id]
+ clippables: [panel.styleDef.ProgressBar_progress_id]
+ x: thumbOffset
+ y: Math.round((Math.round(horizontal ? parent.height : parent.width) - track.height) / 2)
+ width: (horizontal ? parent.width : parent.height) - 2 * thumbOffset
+ }
+ DrawableLoader {
+ id: thumb
+ pressed: control.pressed
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.SeekBar_thumb
+ x: Math.round((control.__handlePos - control.minimumValue) / (control.maximumValue - control.minimumValue) * ((horizontal ? panel.width : panel.height) - thumb.width))
+ }
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/SpinBoxStyle.qml b/src/controls/Styles/Android/SpinBoxStyle.qml
new file mode 100644
index 00000000..cbd52c58
--- /dev/null
+++ b/src/controls/Styles/Android/SpinBoxStyle.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ id: style
+
+ readonly property SpinBox control: __control
+
+ property int renderType: Text.QtRendering
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.editTextStyle
+
+ readonly property real contentWidth: Math.max(styleDef.View_minWidth || 0, styleData.contentWidth)
+ readonly property real contentHeight: Math.max(styleDef.View_minHeight || 0, styleData.contentHeight)
+ readonly property real labelWidth: label.implicitWidth + bg.padding.left + bg.padding.right
+ readonly property real labelHeight: label.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ implicitWidth: Math.max(contentWidth, Math.max(bg.implicitWidth, labelWidth))
+ implicitHeight: Math.max(contentHeight, Math.max(bg.implicitHeight, labelHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef.View_background
+ }
+
+ Binding { target: style; property: "padding.top"; value: bg.padding.top }
+ Binding { target: style; property: "padding.left"; value: bg.padding.left }
+ Binding { target: style; property: "padding.right"; value: bg.padding.right }
+ Binding { target: style; property: "padding.bottom"; value: bg.padding.bottom }
+
+ readonly property alias font: label.font
+ readonly property alias foregroundColor: label.color
+ readonly property alias selectionColor: label.selectionColor
+ readonly property alias selectedTextColor: label.selectedTextColor
+
+ readonly property rect upRect: Qt.rect(0, 0, 0, 0)
+ readonly property rect downRect: Qt.rect(0, 0, 0, 0)
+
+ readonly property int horizontalAlignment: Qt.AlignLeft
+ readonly property int verticalAlignment: Qt.AlignVCenter
+
+ LabelStyle {
+ id: label
+ visible: false
+ text: control.__text
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef
+ }
+ }
+
+ property Component selectionHandle: DrawableLoader {
+ styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
+ x: -width / 4 * 3
+ y: styleData.lineHeight
+ }
+
+ property Component cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/controls/Styles/Android/StatusBarStyle.qml b/src/controls/Styles/Android/StatusBarStyle.qml
new file mode 100644
index 00000000..55feb84d
--- /dev/null
+++ b/src/controls/Styles/Android/StatusBarStyle.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+
+Style {
+ readonly property StatusBar control: __control
+
+ padding {
+ left: 0
+ right: 0
+ top: AndroidStyle.styleDef.actionBarStyle.View_paddingTop
+ bottom: AndroidStyle.styleDef.actionBarStyle.View_paddingBottom
+ }
+
+ property Component panel: Item {
+ implicitWidth: AndroidStyle.styleDef.actionBarStyle.View_minWidth || 0
+ implicitHeight: AndroidStyle.styleDef.actionButtonStyle.View_minHeight || 0
+ }
+}
diff --git a/src/controls/Styles/Android/SwitchStyle.qml b/src/controls/Styles/Android/SwitchStyle.qml
new file mode 100644
index 00000000..60d8f2ef
--- /dev/null
+++ b/src/controls/Styles/Android/SwitchStyle.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.4
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ property Switch control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ // TODO: API level < 14
+ readonly property var styleDef: AndroidStyle.styleDef.switchStyle
+
+ implicitWidth: Math.max(styleDef.Switch_switchMinWidth, Math.max(track.implicitWidth, 2 * thumb.implicitWidth))
+ implicitHeight: Math.max(track.implicitHeight, thumb.implicitHeight)
+
+ property real min: track.padding.left
+ property real max: track.width - thumb.width - track.padding.left
+ property var __handle: thumb
+
+ DrawableLoader {
+ id: track
+ anchors.fill: parent
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.Switch_track
+ }
+
+ Item {
+ id: thumb
+
+ x: control.checked ? max : min
+
+ FontMetrics {
+ id: metrics
+ font: label.font
+ }
+
+ readonly property real maxTextWidth: Math.max(metrics.boundingRect(panel.styleDef.Switch_textOn).width,
+ metrics.boundingRect(panel.styleDef.Switch_textOff).width)
+
+ implicitWidth: Math.max(loader.implicitWidth, maxTextWidth + 2 * panel.styleDef.Switch_thumbTextPadding)
+ implicitHeight: Math.max(loader.implicitHeight, metrics.height)
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ Behavior on x {
+ id: behavior
+ enabled: thumb.status === Loader.Ready
+ NumberAnimation {
+ duration: 150
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ DrawableLoader {
+ id: loader
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: -padding.left
+ anchors.rightMargin: -padding.right
+ anchors.verticalCenter: parent.verticalCenter
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.Switch_thumb
+ }
+
+ LabelStyle {
+ id: label
+ text: control.checked ? panel.styleDef.Switch_textOn : panel.styleDef.Switch_textOff
+
+ pressed: control.pressed
+ focused: control.activeFocus
+ selected: control.checked
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.Switch_switchTextAppearance
+
+ anchors.fill: parent
+ }
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/TabViewStyle.qml b/src/controls/Styles/Android/TabViewStyle.qml
new file mode 100644
index 00000000..6ce1e4bb
--- /dev/null
+++ b/src/controls/Styles/Android/TabViewStyle.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property TabView control: __control
+
+ readonly property bool tabsMovable: false
+ readonly property int tabsAlignment: Qt.AlignLeft
+ readonly property int tabOverlap: 0
+ readonly property int frameOverlap: 0
+
+ property Component frame: null
+ property Component leftCorner: null
+ property Component rightCorner: null
+
+ property Component tabBar: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.actionBarStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+
+ implicitWidth: Math.max(minWidth, loader.implicitWidth)
+ implicitHeight: Math.max(minHeight, loader.implicitHeight)
+
+ DrawableLoader {
+ id: loader
+ anchors.fill: parent
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef.ActionBar_backgroundStacked
+ }
+ }
+
+ property Component tab: Item {
+ id: tab
+
+ readonly property real minHeight: AndroidStyle.styleDef.actionButtonStyle.View_minHeight || 0
+ readonly property real contentHeight: label.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ readonly property real dividerPadding: AndroidStyle.styleDef.actionBarTabBarStyle.LinearLayout_dividerPadding
+
+ implicitWidth: styleData.availableWidth / Math.max(1, control.count)
+ implicitHeight: Math.max(minHeight, Math.max(bg.implicitHeight, contentHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ enabled: styleData.enabled
+ pressed: styleData.pressed
+ selected: styleData.selected
+ focused: styleData.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.actionBarTabStyle.View_background
+ }
+
+ DrawableLoader {
+ id: divider
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ enabled: styleData.enabled
+ pressed: styleData.pressed
+ selected: styleData.selected
+ focused: styleData.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.actionBarTabBarStyle.LinearLayout_divider
+ visible: styleData.index < control.count - 1 && control.count > 1
+ }
+
+ LabelStyle {
+ id: label
+ text: styleData.title
+ pressed: styleData.pressed
+ enabled: styleData.enabled
+ focused: styleData.activeFocus
+ selected: styleData.selected
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.actionBarTabTextStyle
+
+ anchors.fill: bg
+ anchors.topMargin: bg.padding.top
+ anchors.leftMargin: bg.padding.left + dividerPadding
+ anchors.rightMargin: bg.padding.right + dividerPadding
+ anchors.bottomMargin: bg.padding.bottom
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/TableViewStyle.qml b/src/controls/Styles/Android/TableViewStyle.qml
new file mode 100644
index 00000000..aab1ddda
--- /dev/null
+++ b/src/controls/Styles/Android/TableViewStyle.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+ScrollViewStyle {
+ readonly property TableView control: __control
+
+ readonly property color textColor: __label.color
+ readonly property color highlightedTextColor: __label.selectedTextColor
+ readonly property color backgroundColor: control.backgroundVisible ? AndroidStyle.colorValue(AndroidStyle.styleDef.simple_list_item.defaultBackgroundColor) : "transparent"
+ readonly property color alternateBackgroundColor: "transparent"
+ readonly property bool activateItemOnSingleClick: true
+
+ property LabelStyle __label: LabelStyle {
+ styleDef: AndroidStyle.styleDef.simple_list_item
+ visible: false
+ }
+
+ property Component headerDelegate: null
+
+ property Component rowDelegate: Rectangle {
+ readonly property var styleDef: AndroidStyle.styleDef.simple_list_item
+
+ color: styleData.selected && !styleData.pressed ? __label.selectionColor : "transparent"
+ height: Math.max(styleDef.View_minHeight || 0, Math.max(bg.implicitHeight, __label.implicitHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ pressed: styleData.pressed
+ checked: styleData.selected
+ selected: styleData.selected
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.simple_selectable_list_item.View_background
+ }
+
+ DrawableLoader {
+ id: divider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ active: styleData.row < control.rowCount - 1
+ styleDef: AndroidStyle.styleDef.listViewStyle.ListView_divider
+ height: AndroidStyle.styleDef.listViewStyle.ListView_dividerHeight || implicitHeight
+ }
+ }
+
+ property Component itemDelegate: Item {
+ readonly property var styleDef: AndroidStyle.styleDef.simple_list_item
+
+ readonly property real paddingStart: styleDef.View_paddingStart || styleDef.View_paddingLeft || 0
+ readonly property real paddingEnd: styleDef.View_paddingEnd || styleDef.View_paddingRight || 0
+
+ height: Math.max(styleDef.View_minHeight || 0, label.implicitHeight)
+
+ LabelStyle {
+ id: label
+ text: styleData.value !== undefined ? styleData.value : ""
+ elide: styleData.elideMode
+ horizontalAlignment: styleData.textAlignment
+ pressed: styleData.pressed
+ focused: control.activeFocus
+ selected: styleData.selected
+ window_focused: control.window && control.window.active
+ styleDef: parent.styleDef
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: paddingStart
+ anchors.rightMargin: paddingEnd
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/TextAreaStyle.qml b/src/controls/Styles/Android/TextAreaStyle.qml
new file mode 100644
index 00000000..bd1e5956
--- /dev/null
+++ b/src/controls/Styles/Android/TextAreaStyle.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+ScrollViewStyle {
+ id: style
+
+ readonly property TextArea control: __control
+
+ transientScrollBars: true
+
+ readonly property var styleDef: AndroidStyle.styleDef.editTextStyle
+
+ readonly property int renderType: Text.QtRendering
+ readonly property real textMargin: Math.max(styleDef.View_background.padding.top || 0,
+ styleDef.View_background.padding.left || 0)
+
+ readonly property alias font: label.font
+ readonly property alias textColor: label.color
+ readonly property alias placeholderTextColor: label.hintColor
+ readonly property alias selectionColor: label.selectionColor
+ readonly property color selectedTextColor: label.selectedTextColor
+ readonly property color backgroundColor: control.backgroundVisible ? AndroidStyle.colorValue(styleDef.defaultBackgroundColor) : "transparent"
+
+ LabelStyle {
+ id: label
+ visible: false
+ enabled: control.enabled
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: style.styleDef
+ }
+
+ property Component selectionHandle: DrawableLoader {
+ styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
+ x: -width / 4 * 3
+ y: styleData.lineHeight
+ }
+
+ property Component cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/controls/Styles/Android/TextFieldStyle.qml b/src/controls/Styles/Android/TextFieldStyle.qml
new file mode 100644
index 00000000..f5658443
--- /dev/null
+++ b/src/controls/Styles/Android/TextFieldStyle.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property TextField control: __control
+
+ property int renderType: Text.QtRendering
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.editTextStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+ readonly property real labelWidth: label.implicitWidth + bg.padding.left + bg.padding.right
+ readonly property real labelHeight: label.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ implicitWidth: Math.max(minWidth, Math.max(bg.implicitWidth, labelWidth))
+ implicitHeight: Math.max(minHeight, Math.max(bg.implicitHeight, labelHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef.View_background
+ }
+
+ readonly property real topMargin: bg.padding.top
+ readonly property real leftMargin: bg.padding.left
+ readonly property real rightMargin: bg.padding.right
+ readonly property real bottomMargin: bg.padding.bottom
+
+ readonly property alias font: label.font
+ readonly property alias textColor: label.color
+ readonly property alias placeholderTextColor: label.hintColor
+ readonly property alias selectionColor: label.selectionColor
+ readonly property color selectedTextColor: label.selectedTextColor
+
+ LabelStyle {
+ id: label
+ visible: false
+ text: control.text
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef
+ }
+ }
+
+ property Component selectionHandle: DrawableLoader {
+ styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
+ x: -width / 4 * 3
+ y: styleData.lineHeight
+ }
+
+ property Component cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/controls/Styles/Android/ToolBarStyle.qml b/src/controls/Styles/Android/ToolBarStyle.qml
new file mode 100644
index 00000000..5592d756
--- /dev/null
+++ b/src/controls/Styles/Android/ToolBarStyle.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property ToolBar control: __control
+
+ padding {
+ left: 0
+ right: 0
+ top: AndroidStyle.styleDef.actionBarStyle.View_paddingTop
+ bottom: AndroidStyle.styleDef.actionBarStyle.View_paddingBottom
+ }
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.actionBarStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+ readonly property real buttonHeight: AndroidStyle.styleDef.actionButtonStyle.View_minHeight || 0
+
+ implicitWidth: Math.max(minWidth, bg.implicitWidth)
+ implicitHeight: Math.max(minHeight, Math.max(buttonHeight, bg.implicitHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ focused: control.activeFocus
+ window_focused: focused && control.window && control.window.active
+ styleDef: panel.styleDef.ActionBar_backgroundStacked
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/ToolButtonStyle.qml b/src/controls/Styles/Android/ToolButtonStyle.qml
new file mode 100644
index 00000000..3d415a4b
--- /dev/null
+++ b/src/controls/Styles/Android/ToolButtonStyle.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Android 1.0
+import "drawables"
+
+Style {
+ readonly property ToolButton control: __control
+
+ property Component panel: Item {
+ id: panel
+
+ readonly property var styleDef: AndroidStyle.styleDef.actionButtonStyle
+
+ readonly property real minWidth: styleDef.View_minWidth || 0
+ readonly property real minHeight: styleDef.View_minHeight || 0
+ readonly property real paddingStart: styleDef.View_paddingStart || 0
+ readonly property real paddingEnd: styleDef.View_paddingEnd || 0
+ readonly property real contentWidth: row.implicitWidth + bg.padding.left + bg.padding.right + paddingStart + paddingEnd
+ readonly property real contentHeight: row.implicitHeight + bg.padding.top + bg.padding.bottom
+
+ readonly property bool hasMenu: !!control.menu
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+
+ implicitWidth: Math.max(minWidth, Math.max(bg.implicitWidth, contentWidth))
+ implicitHeight: Math.max(minHeight, Math.max(bg.implicitHeight, contentHeight))
+
+ DrawableLoader {
+ id: bg
+ anchors.fill: parent
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef.View_background
+ }
+
+ RowLayout {
+ id: row
+ anchors.fill: parent
+ anchors.topMargin: bg.padding.top
+ anchors.leftMargin: bg.padding.left + paddingStart
+ anchors.rightMargin: bg.padding.right + paddingEnd
+ anchors.bottomMargin: bg.padding.bottom
+ spacing: Math.max(paddingStart, paddingEnd)
+
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ Layout.alignment: Qt.AlignCenter
+ }
+
+ LabelStyle {
+ id: label
+ visible: !!text
+ text: control.text
+ pressed: control.pressed
+ focused: control.activeFocus
+ selected: control.checked
+ window_focused: control.window && control.window.active
+ styleDef: panel.styleDef
+ Layout.fillWidth: true
+ }
+
+ DrawableLoader {
+ active: hasMenu
+ visible: hasMenu
+ pressed: control.pressed
+ checked: control.checked
+ focused: control.activeFocus
+ window_focused: control.window && control.window.active
+ styleDef: AndroidStyle.styleDef.actionOverflowButtonStyle.ImageView_src
+ Layout.alignment: Qt.AlignCenter
+ }
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/AnimationDrawable.qml b/src/controls/Styles/Android/drawables/AnimationDrawable.qml
new file mode 100644
index 00000000..a522bfa7
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/AnimationDrawable.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(loader.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(loader.implicitHeight, styleDef.height || 0)
+
+ property int currentFrame: 0
+ readonly property int frameCount: styleDef.frames ? styleDef.frames.length : 0
+ readonly property var frameDef: styleDef.frames ? styleDef.frames[currentFrame] : undefined
+
+ Timer {
+ repeat: true
+ running: root.frameCount && root.visible && Qt.application.active
+ interval: root.frameDef ? root.frameDef.duration : 0
+ onTriggered: {
+ var frame = root.currentFrame + 1
+ repeat = !root.styleDef.oneshot || frame < root.frameCount - 1
+ root.currentFrame = frame % root.frameCount
+ }
+ }
+
+ DrawableLoader {
+ id: loader
+ anchors.fill: parent
+ styleDef: root.frameDef ? root.frameDef.drawable : undefined
+ focused: root.focused
+ pressed: root.pressed
+ checked: root.checked
+ selected: root.selected
+ accelerated: root.accelerated
+ window_focused: root.window_focused
+ index: root.index
+ level: root.level
+ levelId: root.levelId
+ orientations: root.orientations
+ duration: root.duration
+ excludes: root.excludes
+ clippables: root.clippables
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/ClipDrawable.qml b/src/controls/Styles/Android/drawables/ClipDrawable.qml
new file mode 100644
index 00000000..8a76997a
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/ClipDrawable.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(loader.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(loader.implicitHeight, styleDef.height || 0)
+
+ readonly property bool isClippable: styleDef.id && clippables.indexOf(styleDef.id) !== -1
+
+ Item {
+ clip: true
+ width: orientations & Qt.Horizontal ? level * parent.width : parent.width
+ height: orientations & Qt.Vertical ? level * parent.height : parent.height
+
+ DrawableLoader {
+ id: loader
+ width: root.width
+ height: root.height
+ styleDef: isClippable ? root.styleDef : root.styleDef.drawable
+ focused: root.focused
+ pressed: root.pressed
+ checked: root.checked
+ selected: root.selected
+ accelerated: root.accelerated
+ window_focused: root.window_focused
+ index: root.index
+ level: root.level
+ levelId: root.levelId
+ orientations: root.orientations
+ duration: root.duration
+ excludes: root.excludes
+ clippables: root.clippables
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/ColorDrawable.qml b/src/controls/Styles/Android/drawables/ColorDrawable.qml
new file mode 100644
index 00000000..7dfd2f03
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/ColorDrawable.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls.Styles.Android 1.0
+
+Drawable {
+ id: root
+
+ Rectangle {
+ anchors.fill: parent
+ color: AndroidStyle.colorValue(styleDef.color)
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/Drawable.qml b/src/controls/Styles/Android/drawables/Drawable.qml
new file mode 100644
index 00000000..54b3e3e4
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/Drawable.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+
+Item {
+ id: root
+
+ property var styleDef
+
+ property bool focused
+ property bool pressed
+ property bool checked
+ property bool selected
+ property bool accelerated
+ property bool window_focused
+
+ property int index: -1
+ property real level: 0
+ property string levelId: ""
+ property int orientations: Qt.Horizontal
+ property int duration: 0
+
+ property var excludes: []
+ property var clippables: []
+
+ property Padding padding: Padding {
+ top: styleDef.padding ? styleDef.padding.top : 0
+ left: styleDef.padding ? styleDef.padding.left : 0
+ right: styleDef.padding ? styleDef.padding.right : 0
+ bottom: styleDef.padding ? styleDef.padding.bottom : 0
+ }
+
+ implicitWidth: styleDef.width || 0
+ implicitHeight: styleDef.height || 0
+}
diff --git a/src/controls/Styles/Android/drawables/DrawableLoader.qml b/src/controls/Styles/Android/drawables/DrawableLoader.qml
new file mode 100644
index 00000000..4dd82c03
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/DrawableLoader.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+
+Loader {
+ id: loader
+
+ property var styleDef
+
+ property bool focused
+ property bool pressed
+ property bool checked
+ property bool selected
+ property bool accelerated
+ property bool window_focused
+
+ property int index: 0
+ property real level: 0
+ property string levelId: ""
+ property int orientations: Qt.Horizontal
+ property int duration: 0
+
+ property var excludes: []
+ property var clippables: []
+
+ property Padding padding: Padding {
+ top: loader.item ? loader.item.padding.top : 0
+ left: loader.item ? loader.item.padding.left : 0
+ right: loader.item ? loader.item.padding.right : 0
+ bottom: loader.item ? loader.item.padding.bottom : 0
+ }
+
+ readonly property string type: styleDef ? styleDef.type : ""
+
+ readonly property bool isExcluded: !!styleDef && excludes.indexOf(styleDef.id) !== -1
+ readonly property bool isClippable: !!styleDef && clippables.indexOf(styleDef.id) !== -1
+
+ active: !!styleDef && !isExcluded
+ sourceComponent: type === "animation" ? Qt.createComponent("AnimationDrawable.qml") :
+ isClippable || type === "clipDrawable" ? Qt.createComponent("ClipDrawable.qml") :
+ type === "color" ? Qt.createComponent("ColorDrawable.qml") :
+ type === "gradient" ? Qt.createComponent("GradientDrawable.qml") :
+ type === "image" ? Qt.createComponent("ImageDrawable.qml") :
+ type === "layer" ? Qt.createComponent("LayerDrawable.qml") :
+ type === "9patch" ? Qt.createComponent("NinePatchDrawable.qml") :
+ type === "rotate" ? Qt.createComponent("RotateDrawable.qml") :
+ type === "stateslist" ? Qt.createComponent("StateDrawable.qml") : null
+
+ Binding { target: loader.item; property: "styleDef"; value: loader.styleDef }
+ Binding { target: loader.item; property: "focused"; value: loader.focused }
+ Binding { target: loader.item; property: "pressed"; value: loader.pressed }
+ Binding { target: loader.item; property: "checked"; value: loader.checked }
+ Binding { target: loader.item; property: "selected"; value: loader.selected }
+ Binding { target: loader.item; property: "accelerated"; value: loader.accelerated }
+ Binding { target: loader.item; property: "window_focused"; value: loader.window_focused }
+ Binding { target: loader.item; property: "level"; value: loader.level }
+ Binding { target: loader.item; property: "levelId"; value: loader.levelId }
+ Binding { target: loader.item; property: "orientations"; value: loader.orientations }
+ Binding { target: loader.item; property: "duration"; value: loader.duration }
+ Binding { target: loader.item; property: "excludes"; value: loader.excludes }
+ Binding { target: loader.item; property: "clippables"; value: loader.clippables }
+}
diff --git a/src/controls/Styles/Android/drawables/GradientDrawable.qml b/src/controls/Styles/Android/drawables/GradientDrawable.qml
new file mode 100644
index 00000000..a9474737
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/GradientDrawable.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls.Styles.Android 1.0
+
+ColorDrawable {
+ id: root
+
+ Component {
+ id: component
+ GradientStop { }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient {
+ id: gradient
+ function reload() {
+ var stops = []
+ if (styleDef && styleDef.colors) {
+ for (var i = 0; i < styleDef.colors.length; ++i) {
+ var stop = component.createObject(root)
+ stop.color = AndroidStyle.colorValue(styleDef.colors[i])
+ if (styleDef.positions[i] !== undefined)
+ stop.position = styleDef.positions[i]
+ else // spread evenly if positions are not defined
+ stop.position = i / (styleDef.colors.length - 1)
+ stops.push(stop)
+ }
+ }
+ gradient.stops = stops
+ }
+ }
+ }
+
+ onStyleDefChanged: gradient.reload()
+ Component.onCompleted: gradient.reload()
+}
diff --git a/src/controls/Styles/Android/drawables/ImageDrawable.qml b/src/controls/Styles/Android/drawables/ImageDrawable.qml
new file mode 100644
index 00000000..1e71a389
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/ImageDrawable.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls.Styles.Android 1.0
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(image.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(image.implicitHeight, styleDef.height || 0)
+
+ Image {
+ id: image
+ anchors.fill: parent
+ fillMode: Image.TileHorizontally
+ source: AndroidStyle.filePath(styleDef.path)
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/LayerDrawable.qml b/src/controls/Styles/Android/drawables/LayerDrawable.qml
new file mode 100644
index 00000000..74122a23
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/LayerDrawable.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(repeater.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(repeater.implicitHeight, styleDef.height || 0)
+
+ Repeater {
+ id: repeater
+ anchors.fill: parent
+ model: index >= 0 ? [styleDef.layers[index]] : styleDef.layers
+ DrawableLoader {
+ id: loader
+ anchors.fill: parent
+ styleDef: modelData
+ focused: root.focused
+ pressed: root.pressed
+ checked: root.checked
+ selected: root.selected
+ accelerated: root.accelerated
+ window_focused: root.window_focused
+ index: root.index
+ level: root.level
+ levelId: root.levelId
+ orientations: root.orientations
+ duration: root.duration
+ excludes: root.excludes
+ clippables: root.clippables
+ // TODO: find a cleaner way to promote the implicit size of the largest layer
+ onImplicitWidthChanged: repeater.implicitWidth = Math.max(implicitWidth, repeater.implicitWidth)
+ onImplicitHeightChanged: repeater.implicitHeight = Math.max(implicitHeight, repeater.implicitHeight)
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/NinePatchDrawable.qml b/src/controls/Styles/Android/drawables/NinePatchDrawable.qml
new file mode 100644
index 00000000..c641089a
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/NinePatchDrawable.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Controls.Styles.Android 1.0
+
+Drawable {
+ id: root
+
+ readonly property bool isLevelId: levelId == styleDef.id
+ implicitWidth: Math.max(image.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(image.implicitHeight, styleDef.height || 0)
+ clip: image.usesLevelWidth && image.width < image.sourceSize.width
+ || image.usesLevelHeight && height < image.sourceSize.height
+
+ Android9Patch {
+ id: image
+ readonly property bool usesLevelWidth: isLevelId && (orientations & Qt.Horizontal)
+ readonly property bool usesLevelHeight: isLevelId && (orientations & Qt.Vertical)
+ width: usesLevelWidth ? level * parent.width : parent.width
+ height: usesLevelHeight ? level * parent.height : parent.height
+ xDivs: styleDef.chunkInfo ? styleDef.chunkInfo.xdivs : []
+ yDivs: styleDef.chunkInfo ? styleDef.chunkInfo.ydivs : []
+ source: styleDef.drawable ? AndroidStyle.filePath(styleDef.drawable.path) : ""
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/RotateDrawable.qml b/src/controls/Styles/Android/drawables/RotateDrawable.qml
new file mode 100644
index 00000000..7ca75c46
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/RotateDrawable.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(loader.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(loader.implicitHeight, styleDef.height || 0)
+
+ DrawableLoader {
+ id: loader
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ styleDef: root.styleDef.drawable
+ focused: root.focused
+ pressed: root.pressed
+ checked: root.checked
+ selected: root.selected
+ accelerated: root.accelerated
+ window_focused: root.window_focused
+ index: root.index
+ level: root.level
+ levelId: root.levelId
+ orientations: root.orientations
+ duration: root.duration
+ excludes: root.excludes
+ clippables: root.clippables
+
+ // TODO:
+ // - real root.styleDef.pivotX, pivotXRel (bool)
+ // - real root.styleDef.pivotY, pivotYRel (bool)
+
+ RotationAnimator on rotation {
+ duration: root.duration
+ loops: Animation.Infinite
+ from: root.styleDef.fromDegrees
+ to: root.styleDef.toDegrees
+ running: (from || to) && root.visible && Qt.application.active
+ }
+ }
+}
diff --git a/src/controls/Styles/Android/drawables/StateDrawable.qml b/src/controls/Styles/Android/drawables/StateDrawable.qml
new file mode 100644
index 00000000..d446542d
--- /dev/null
+++ b/src/controls/Styles/Android/drawables/StateDrawable.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $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.2
+
+Drawable {
+ id: root
+
+ implicitWidth: Math.max(loader.implicitWidth, styleDef.width || 0)
+ implicitHeight: Math.max(loader.implicitHeight, styleDef.height || 0)
+
+ DrawableLoader {
+ id: loader
+ anchors.fill: parent
+ styleDef: bestStateMatch()
+ focused: root.focused
+ pressed: root.pressed
+ checked: root.checked
+ selected: root.selected
+ accelerated: root.accelerated
+ window_focused: root.window_focused
+ index: root.index
+ level: root.level
+ levelId: root.levelId
+ orientations: root.orientations
+ duration: root.duration
+ excludes: root.excludes
+ clippables: root.clippables
+ }
+
+ function bestStateMatch () {
+ if (styleDef && styleDef.stateslist) {
+ var bestMatch = 0
+ var highestScore = -1
+ var stateslist = styleDef.stateslist
+
+ for (var i = 0; i < stateslist.length; ++i) {
+
+ var score = 0
+ var state = stateslist[i]
+
+ for (var s in state.states) {
+ if (s === "pressed")
+ score += (pressed === state.states[s]) ? 1 : -10
+ if (s === "checked")
+ score += (checked === state.states[s]) ? 1 : -10
+ if (s === "selected")
+ score += (selected === state.states[s]) ? 1 : -10
+ if (s === "focused")
+ score += (focused === state.states[s]) ? 1 : -10
+ if (s === "enabled")
+ score += (enabled === state.states[s]) ? 1 : -1
+ if (s === "window_focused")
+ score += (window_focused === state.states[s]) ? 1 : -1
+ if (s === "accelerated")
+ score += (accelerated === state.states[s]) ? 1 : -1
+ }
+
+ if (score > highestScore) {
+ bestMatch = i
+ highestScore = score
+ }
+ }
+ return stateslist[bestMatch].drawable
+ }
+ return undefined
+ }
+}
diff --git a/src/controls/Styles/Android/plugin.cpp b/src/controls/Styles/Android/plugin.cpp
new file mode 100644
index 00000000..84bb7041
--- /dev/null
+++ b/src/controls/Styles/Android/plugin.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+#include "qquickandroidstyle_p.h"
+#include "qquickandroid9patch_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickControlsAndroidStylePlugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ void registerTypes(const char *uri);
+};
+
+void QtQuickControlsAndroidStylePlugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<QQuickAndroid9Patch>(uri, 1, 0, "Android9Patch");
+ qmlRegisterType<QQuickAndroidStyle>(uri, 1, 0, "AndroidStyleBase");
+}
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/src/controls/Styles/Android/qmldir b/src/controls/Styles/Android/qmldir
new file mode 100644
index 00000000..21bff691
--- /dev/null
+++ b/src/controls/Styles/Android/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Controls.Styles.Android
+plugin qtquickcontrolsandroidstyleplugin
+classname QtQuickControlsAndroidStylePlugin
+singleton AndroidStyle 1.0 AndroidStyle.qml
diff --git a/src/controls/Styles/Android/qquickandroid9patch.cpp b/src/controls/Styles/Android/qquickandroid9patch.cpp
new file mode 100644
index 00000000..031abeaf
--- /dev/null
+++ b/src/controls/Styles/Android/qquickandroid9patch.cpp
@@ -0,0 +1,297 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickandroid9patch_p.h"
+#include <qquickwindow.h>
+#include <qsgnode.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAndroid9PatchNode : public QSGGeometryNode
+{
+public:
+ QQuickAndroid9PatchNode();
+ ~QQuickAndroid9PatchNode();
+
+ void initialize(QSGTexture *texture, const QRectF &bounds, const QSize &sourceSize,
+ const QQuickAndroid9PatchDivs &xDivs, const QQuickAndroid9PatchDivs &yDivs);
+
+private:
+ QSGGeometry m_geometry;
+ QSGTextureMaterial m_material;
+};
+
+QQuickAndroid9PatchNode::QQuickAndroid9PatchNode()
+ : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+{
+ m_geometry.setDrawingMode(GL_TRIANGLES);
+ setGeometry(&m_geometry);
+ setMaterial(&m_material);
+}
+
+QQuickAndroid9PatchNode::~QQuickAndroid9PatchNode()
+{
+ delete m_material.texture();
+}
+
+void QQuickAndroid9PatchNode::initialize(QSGTexture *texture, const QRectF &bounds, const QSize &sourceSize,
+ const QQuickAndroid9PatchDivs &xDivs, const QQuickAndroid9PatchDivs &yDivs)
+{
+ delete m_material.texture();
+ m_material.setTexture(texture);
+
+ const int xlen = xDivs.data.size();
+ const int ylen = yDivs.data.size();
+
+ if (xlen > 0 && ylen > 0) {
+ const int quads = (xlen - 1) * (ylen - 1);
+ static const int verticesPerQuad = 6;
+ m_geometry.allocate(xlen * ylen, verticesPerQuad * quads);
+
+ QSGGeometry::TexturedPoint2D *vertices = m_geometry.vertexDataAsTexturedPoint2D();
+ QVector<qreal> xCoords = xDivs.coordsForSize(bounds.width());
+ QVector<qreal> yCoords = yDivs.coordsForSize(bounds.height());
+ for (int y = 0; y < ylen; ++y) {
+ for (int x = 0; x < xlen; ++x, ++vertices)
+ vertices->set(xCoords[x], yCoords[y], xDivs.data[x] / sourceSize.width(),
+ yDivs.data[y] / sourceSize.height());
+ }
+
+ quint16 *indices = m_geometry.indexDataAsUShort();
+ int n = quads;
+ for (int q = 0; n--; ++q) {
+ if ((q + 1) % xlen == 0) // next row
+ ++q;
+ // Bottom-left half quad triangle
+ indices[0] = q;
+ indices[1] = q + xlen;
+ indices[2] = q + xlen + 1;
+
+ // Top-right half quad triangle
+ indices[3] = q;
+ indices[4] = q + xlen + 1;
+ indices[5] = q + 1;
+
+ indices += verticesPerQuad;
+ }
+ }
+
+ markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial);
+}
+
+QVector<qreal> QQuickAndroid9PatchDivs::coordsForSize(qreal size) const
+{
+ // n = number of stretchable sections
+ // We have to compensate when adding 0 and/or
+ // the source image width to the divs vector.
+ const int l = data.size();
+ const int n = (inverted ? l - 1 : l) >> 1;
+ const qreal stretchAmount = (size - data.last()) / n;
+
+ QVector<qreal> coords;
+ coords.reserve(l);
+ coords.append(0);
+
+ bool stretch = !inverted;
+ for (int i = 1; i < l; ++i) {
+ qreal advance = data[i] - data[i - 1];
+ if (stretch)
+ advance += stretchAmount;
+ coords.append(coords.last() + advance);
+
+ stretch = !stretch;
+ }
+
+ return coords;
+}
+
+void QQuickAndroid9PatchDivs::fill(const QVariantList &divs, qreal size)
+{
+ if (!data.isEmpty())
+ return;
+
+ inverted = divs.isEmpty() || divs.first().toInt() != 0;
+ // Reserve an extra item in case we need to add the image width/height
+ if (inverted) {
+ data.reserve(divs.size() + 2);
+ data.append(0);
+ } else {
+ data.reserve(divs.size() + 1);
+ }
+
+ foreach (const QVariant &div, divs)
+ data.append(div.toReal());
+
+ data.append(size);
+}
+
+void QQuickAndroid9PatchDivs::clear()
+{
+ data.clear();
+}
+
+QQuickAndroid9Patch::QQuickAndroid9Patch(QQuickItem *parent) : QQuickItem(parent)
+{
+ connect(this, SIGNAL(widthChanged()), this, SLOT(updateDivs()));
+ connect(this, SIGNAL(heightChanged()), this, SLOT(updateDivs()));
+}
+
+QQuickAndroid9Patch::~QQuickAndroid9Patch()
+{
+}
+
+QUrl QQuickAndroid9Patch::source() const
+{
+ return m_source;
+}
+
+void QQuickAndroid9Patch::setSource(const QUrl &source)
+{
+ if (m_source != source) {
+ m_source = source;
+ m_xDivs.clear();
+ m_yDivs.clear();
+ loadImage();
+ m_sourceSize = m_image.size();
+
+ emit sourceChanged(source);
+ emit sourceSizeChanged(m_sourceSize);
+ }
+}
+
+QVariantList QQuickAndroid9Patch::xDivs() const
+{
+ return m_xVars;
+}
+
+void QQuickAndroid9Patch::setXDivs(const QVariantList &divs)
+{
+ if (m_xVars != divs) {
+ m_xVars = divs;
+
+ m_xDivs.clear();
+ updateDivs();
+ emit xDivsChanged(divs);
+ }
+}
+
+QVariantList QQuickAndroid9Patch::yDivs() const
+{
+ return m_yVars;
+}
+
+void QQuickAndroid9Patch::setYDivs(const QVariantList &divs)
+{
+ if (m_yVars != divs) {
+ m_yVars = divs;
+
+ m_yDivs.clear();
+ updateDivs();
+ emit yDivsChanged(divs);
+ }
+}
+
+QSize QQuickAndroid9Patch::sourceSize() const
+{
+ return m_sourceSize;
+}
+
+void QQuickAndroid9Patch::classBegin()
+{
+ QQuickItem::classBegin();
+}
+
+void QQuickAndroid9Patch::componentComplete()
+{
+ QQuickItem::componentComplete();
+ loadImage();
+}
+
+QSGNode *QQuickAndroid9Patch::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
+{
+ Q_UNUSED(data);
+
+ if (m_image.isNull()) {
+ delete node;
+ return 0;
+ }
+
+ QQuickAndroid9PatchNode *patchNode = static_cast<QQuickAndroid9PatchNode *>(node);
+ if (!patchNode)
+ patchNode = new QQuickAndroid9PatchNode;
+
+#ifdef QSG_RUNTIME_DESCRIPTION
+ qsgnode_set_description(patchNode, QString::fromLatin1("Android9Patch: '%1'").arg(m_source.toString()));
+#endif
+
+ QSGTexture *texture = window()->createTextureFromImage(m_image);
+ patchNode->initialize(texture, boundingRect(), m_image.size(), m_xDivs, m_yDivs);
+ return patchNode;
+}
+
+void QQuickAndroid9Patch::loadImage()
+{
+ if (!isComponentComplete())
+ return;
+
+ if (m_source.isEmpty())
+ m_image = QImage();
+ else
+ m_image = QImage(m_source.toLocalFile());
+
+ setFlag(QQuickItem::ItemHasContents, !m_image.isNull());
+ setImplicitSize(m_image.width(), m_image.height());
+
+ updateDivs();
+}
+
+void QQuickAndroid9Patch::updateDivs()
+{
+ if (!isComponentComplete() || m_image.isNull() || width() <= 0 || height() <= 0)
+ return;
+
+ m_xDivs.fill(m_xVars, m_image.width());
+ m_yDivs.fill(m_yVars, m_image.height());
+
+ update();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/Styles/Android/qquickandroid9patch_p.h b/src/controls/Styles/Android/qquickandroid9patch_p.h
new file mode 100644
index 00000000..09def9a3
--- /dev/null
+++ b/src/controls/Styles/Android/qquickandroid9patch_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKANDROID9PATCH_P_H
+#define QQUICKANDROID9PATCH_P_H
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qsggeometry.h>
+#include <QtQuick/qsgtexturematerial.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QQuickAndroid9PatchDivs
+{
+ QVector<qreal> coordsForSize(qreal size) const;
+
+ void fill(const QVariantList &divs, qreal size);
+ void clear();
+
+ bool inverted;
+ QVector<qreal> data;
+};
+
+class QQuickAndroid9Patch : public QQuickItem
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+ Q_PROPERTY(QVariantList xDivs READ xDivs WRITE setXDivs NOTIFY xDivsChanged FINAL)
+ Q_PROPERTY(QVariantList yDivs READ yDivs WRITE setYDivs NOTIFY yDivsChanged FINAL)
+ Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged FINAL)
+
+public:
+ explicit QQuickAndroid9Patch(QQuickItem *parent = 0);
+ ~QQuickAndroid9Patch();
+
+ QUrl source() const;
+ QVariantList xDivs() const;
+ QVariantList yDivs() const;
+ QSize sourceSize() const;
+
+Q_SIGNALS:
+ void sourceChanged(const QUrl &source);
+ void xDivsChanged(const QVariantList &divs);
+ void yDivsChanged(const QVariantList &divs);
+ void sourceSizeChanged(const QSize &size);
+
+public Q_SLOTS:
+ void setSource(const QUrl &source);
+ void setXDivs(const QVariantList &divs);
+ void setYDivs(const QVariantList &divs);
+
+protected:
+ void classBegin();
+ void componentComplete();
+ QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *data);
+
+private Q_SLOTS:
+ void loadImage();
+ void updateDivs();
+
+private:
+ QImage m_image;
+ QUrl m_source;
+ QSize m_sourceSize;
+ QVariantList m_xVars;
+ QVariantList m_yVars;
+ QQuickAndroid9PatchDivs m_xDivs;
+ QQuickAndroid9PatchDivs m_yDivs;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKANDROID9PATCH_P_H
diff --git a/src/controls/Styles/Android/qquickandroidstyle.cpp b/src/controls/Styles/Android/qquickandroidstyle.cpp
new file mode 100644
index 00000000..bb0941e7
--- /dev/null
+++ b/src/controls/Styles/Android/qquickandroidstyle.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickandroidstyle_p.h"
+#include <qfileinfo.h>
+#include <qfile.h>
+
+QT_BEGIN_NAMESPACE
+
+static QByteArray readFile(const QString &filePath)
+{
+ QFile file(filePath);
+ if (file.open(QFile::ReadOnly | QFile::Text))
+ return file.readAll();
+ qWarning("QQuickAndroidStyle: failed to read %s", qPrintable(filePath));
+ return QByteArray();
+}
+
+static QString resolvePath()
+{
+ QString stylePath(QFile::decodeName(qgetenv("MINISTRO_ANDROID_STYLE_PATH")));
+ const QLatin1Char slashChar('/');
+ if (!stylePath.isEmpty() && !stylePath.endsWith(slashChar))
+ stylePath += slashChar;
+
+ QString androidTheme = QLatin1String(qgetenv("QT_ANDROID_THEME"));
+ if (!androidTheme.isEmpty() && !androidTheme.endsWith(slashChar))
+ androidTheme += slashChar;
+
+ if (stylePath.isEmpty())
+ stylePath = QLatin1String("/data/data/org.kde.necessitas.ministro/files/dl/style/")
+ + QLatin1String(qgetenv("QT_ANDROID_THEME_DISPLAY_DPI")) + slashChar;
+ Q_ASSERT(!stylePath.isEmpty());
+
+ if (!androidTheme.isEmpty() && QFileInfo(stylePath + androidTheme + QLatin1String("style.json")).exists())
+ stylePath += androidTheme;
+ return stylePath;
+}
+
+QQuickAndroidStyle::QQuickAndroidStyle(QObject *parent) : QObject(parent)
+{
+ m_path = resolvePath();
+}
+
+QByteArray QQuickAndroidStyle::data() const
+{
+ if (m_data.isNull() && !m_path.isNull())
+ m_data = readFile(m_path + QLatin1String("style.json"));
+ return m_data;
+}
+
+QString QQuickAndroidStyle::filePath(const QString &fileName) const
+{
+ if (!fileName.isEmpty())
+ return m_path + QFileInfo(fileName).fileName();
+ return QString();
+}
+
+QColor QQuickAndroidStyle::colorValue(uint value) const
+{
+ return QColor::fromRgba(value);
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/Styles/Android/qquickandroidstyle_p.h b/src/controls/Styles/Android/qquickandroidstyle_p.h
new file mode 100644
index 00000000..602811e6
--- /dev/null
+++ b/src/controls/Styles/Android/qquickandroidstyle_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKANDROIDSTYLE_P_H
+#define QQUICKANDROIDSTYLE_P_H
+
+#include <QtCore/qobject.h>
+#include <QtGui/qcolor.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAndroidStyle : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QByteArray data READ data CONSTANT FINAL)
+ Q_ENUMS(Gravity)
+
+public:
+ QQuickAndroidStyle(QObject *parent = 0);
+
+ QByteArray data() const;
+
+ Q_INVOKABLE QColor colorValue(uint value) const;
+ Q_INVOKABLE QString filePath(const QString &fileName) const;
+
+ enum Gravity {
+ NO_GRAVITY = 0x0000,
+ AXIS_SPECIFIED = 0x0001,
+ AXIS_PULL_BEFORE = 0x0002,
+ AXIS_PULL_AFTER = 0x0004,
+ AXIS_CLIP = 0x0008,
+ AXIS_X_SHIFT = 0,
+ AXIS_Y_SHIFT = 4,
+ TOP = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_Y_SHIFT,
+ BOTTOM = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_Y_SHIFT,
+ LEFT = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_X_SHIFT,
+ RIGHT = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_X_SHIFT,
+ CENTER_VERTICAL = AXIS_SPECIFIED << AXIS_Y_SHIFT,
+ FILL_VERTICAL = TOP | BOTTOM,
+ CENTER_HORIZONTAL = AXIS_SPECIFIED << AXIS_X_SHIFT,
+ FILL_HORIZONTAL = LEFT | RIGHT,
+ CENTER = CENTER_VERTICAL | CENTER_HORIZONTAL,
+ FILL = FILL_VERTICAL | FILL_HORIZONTAL,
+ CLIP_VERTICAL = AXIS_CLIP << AXIS_Y_SHIFT,
+ CLIP_HORIZONTAL = AXIS_CLIP << AXIS_X_SHIFT,
+ RELATIVE_LAYOUT_DIRECTION = 0x00800000,
+ HORIZONTAL_GRAVITY_MASK = (AXIS_SPECIFIED | AXIS_PULL_BEFORE | AXIS_PULL_AFTER) << AXIS_X_SHIFT,
+ VERTICAL_GRAVITY_MASK = (AXIS_SPECIFIED | AXIS_PULL_BEFORE | AXIS_PULL_AFTER) << AXIS_Y_SHIFT,
+ DISPLAY_CLIP_VERTICAL = 0x10000000,
+ DISPLAY_CLIP_HORIZONTAL = 0x01000000,
+ START = RELATIVE_LAYOUT_DIRECTION | LEFT,
+ END = RELATIVE_LAYOUT_DIRECTION | RIGHT,
+ RELATIVE_HORIZONTAL_GRAVITY_MASK = START | END
+ };
+
+private:
+ QString m_path;
+ mutable QByteArray m_data;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKANDROIDSTYLE_P_H