diff options
author | Caroline Chao <caroline.chao@digia.com> | 2013-07-31 13:38:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-16 17:32:06 +0200 |
commit | 5483ccd3547dcb3edbe4c50d70e6921ee5c5cb7a (patch) | |
tree | 634db3b0a47cf54e68fe232d5664cbde2dd8579a /src/controls/Styles/Desktop | |
parent | 2b308e33bec09c8a792b37282f6172a59dc3d543 (diff) | |
download | qtquickcontrols-5483ccd3547dcb3edbe4c50d70e6921ee5c5cb7a.tar.gz |
Move Styles and Private under controls
Register the C++ private API from the controls plugin. The
private plugin is not needed anymore.
The Controls "submodules" Styles and Private are moved to
the controls subfolder in the sources tree.
Change-Id: I98358227c945b6cd1a8dbff9d07e6cad4f044277
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/Styles/Desktop')
18 files changed, 1493 insertions, 0 deletions
diff --git a/src/controls/Styles/Desktop/ButtonStyle.qml b/src/controls/Styles/Desktop/ButtonStyle.qml new file mode 100644 index 00000000..2385873e --- /dev/null +++ b/src/controls/Styles/Desktop/ButtonStyle.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + elementType: "button" + sunken: control.pressed || (control.checkable && control.checked) + raised: !(control.pressed || (control.checkable && control.checked)) + hover: control.hovered + text: control.iconSource === "" ? "" : control.text + hasFocus: control.activeFocus + hints: control.styleHints + // If no icon, let the style do the drawing + activeControl: control.isDefault ? "default" : "f" + + properties: { + "icon": control.__iconAction.__icon, + "menu": control.menu + } + } +} diff --git a/src/controls/Styles/Desktop/CheckBoxStyle.qml b/src/controls/Styles/Desktop/CheckBoxStyle.qml new file mode 100644 index 00000000..6bbb5b1d --- /dev/null +++ b/src/controls/Styles/Desktop/CheckBoxStyle.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + + StyleItem { + id: styleitem + elementType: "checkbox" + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) } + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 1 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/src/controls/Styles/Desktop/ComboBoxStyle.qml b/src/controls/Styles/Desktop/ComboBoxStyle.qml new file mode 100644 index 00000000..95397641 --- /dev/null +++ b/src/controls/Styles/Desktop/ComboBoxStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property ComboBox control: __control + property Component panel: Item { + property bool popup: !!styleItem.styleHint("comboboxpopup") + + implicitWidth: 115 + implicitHeight: styleItem.implicitHeight + anchors.fill: parent + StyleItem { + id: styleItem + + height: parent.height + width: parent.width + elementType: "combobox" + sunken: control.pressed + raised: !sunken + hover: control.hovered + enabled: control.enabled + // The style makes sure the text rendering won't overlap the decoration. + // In that case, 35 pixels margin in this case looks good enough. Worst + // case, the ellipsis will be truncated (2nd worst, not visible at all). + text: elidedText(control.currentText, Text.ElideRight, parent.width - 35) + hasFocus: control.activeFocus + // contentHeight as in QComboBox + contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2 + + hints: control.styleHints + properties: { + "popup": control.__popup + } + } + } + + property Component __popupStyle: MenuStyle { + __menuItemType: "comboboxitem" + } + + property Component __dropDownStyle: Style { + property Component frame: StyleItem { + elementType: "frame" + + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 * pixelMetric("defaultframewidth") + } + + property Component menuItem: StyleItem { + elementType: "itemrow" + selected: parent ? parent.selected : false + + x: pixelMetric("defaultframewidth") + y: pixelMetric("defaultframewidth") + + implicitWidth: textItem.contentWidth + implicitHeight: textItem.contentHeight + + StyleItem { + id: textItem + elementType: "item" + contentWidth: textWidth(text) + contentHeight: textHeight(text) + text: parent && parent.parent ? parent.parent.text : "" + selected: parent ? parent.selected : false + } + } + } +} diff --git a/src/controls/Styles/Desktop/FocusFrameStyle.qml b/src/controls/Styles/Desktop/FocusFrameStyle.qml new file mode 100644 index 00000000..420a0ab5 --- /dev/null +++ b/src/controls/Styles/Desktop/FocusFrameStyle.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrameStyle + \internal + \inqmlmodule QtQuick.Controls.Styles 1.0 +*/ +StyleItem { + property int margin: -3 + anchors.fill: parent + elementType: "focusframe" +} + + diff --git a/src/controls/Styles/Desktop/GroupBoxStyle.qml b/src/controls/Styles/Desktop/GroupBoxStyle.qml new file mode 100644 index 00000000..835dd718 --- /dev/null +++ b/src/controls/Styles/Desktop/GroupBoxStyle.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + + +Style { + readonly property GroupBox control: __control + + property var __style: StyleItem { id: style } + property int titleHeight: 18 + + Component.onCompleted: { + var stylename = __style.style + if (stylename.indexOf("windows") > -1) + titleHeight = 9 + } + + padding { + top: Math.round(Settings.dpiScaleFactor * (control.title.length > 0 || control.checkable ? titleHeight : 0) + (style.style == "mac" ? 9 : 6)) + left: Math.round(Settings.dpiScaleFactor * 8) + right: Math.round(Settings.dpiScaleFactor * 8) + bottom: Math.round(Settings.dpiScaleFactor * 7 + (style.style.indexOf("windows") > -1 ? 2 : 0)) + } + + property Component panel: StyleItem { + anchors.fill: parent + id: styleitem + elementType: "groupbox" + text: control.title + on: control.checked + hasFocus: control.__checkbox.activeFocus + activeControl: control.checkable ? "checkbox" : "" + properties: { "checkable" : control.checkable , "sunken" : !control.flat} + } +} diff --git a/src/controls/Styles/Desktop/MenuBarStyle.qml b/src/controls/Styles/Desktop/MenuBarStyle.qml new file mode 100644 index 00000000..291df0fb --- /dev/null +++ b/src/controls/Styles/Desktop/MenuBarStyle.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + + +Style { + property Component frame: StyleItem { + elementType: "menubar" + contentWidth: control.__contentItem.width + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + 2 * (pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth")) + height: implicitHeight + 2 * (pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth")) + + pixelMetric("spacebelowmenubar") + } + + property Component menuItem: StyleItem { + elementType: "menubaritem" + x: pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth") + y: pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth") + + text: menuItem.title + contentWidth: textWidth(text) + contentHeight: textHeight(text) + width: implicitWidth + pixelMetric("menubaritemspacing") + + enabled: menuItem.enabled + selected: (parent && parent.selected) || sunken + sunken: parent && parent.sunken + } +} diff --git a/src/controls/Styles/Desktop/MenuStyle.qml b/src/controls/Styles/Desktop/MenuStyle.qml new file mode 100644 index 00000000..960a163d --- /dev/null +++ b/src/controls/Styles/Desktop/MenuStyle.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + id: styleRoot + + property string __menuItemType: "menuitem" + + property Component frame: StyleItem { + elementType: "menu" + + contentWidth: parent ? parent.contentWidth : 0 + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + 2 * (pixelMetric("menuhmargin") + pixelMetric("menupanelwidth")) + height: implicitHeight + 2 * (pixelMetric("menuvmargin") + pixelMetric("menupanelwidth")) + + property int subMenuOverlap: pixelMetric("submenuoverlap") + + Rectangle { + visible: anchors.margins > 0 + anchors { + fill: parent + margins: pixelMetric("menupanelwidth") + } + color: __syspal.window + } + } + + property Component menuItem: StyleItem { + elementType: __menuItemType + x: pixelMetric("menuhmargin") + pixelMetric("menupanelwidth") + y: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth") + + text: !!parent && parent.text + property string textAndShorcut: text + (properties.shortcut ? "\t" + properties.shortcut : "") + contentWidth: textWidth(textAndShorcut) + contentHeight: textHeight(textAndShorcut) + + enabled: !!parent && parent.enabled + selected: !!parent && parent.selected + on: !!menuItem && !!menuItem["checkable"] && menuItem.checked + + properties: { + "checkable": !!menuItem && !!menuItem["checkable"], + "exclusive": !!menuItem && !!menuItem["exclusiveGroup"], + "shortcut": !!menuItem && menuItem["shortcut"] || "", + "isSubmenu": isSubmenu, + "icon": !!menuItem && menuItem.__icon + } + } +} diff --git a/src/controls/Styles/Desktop/ProgressBarStyle.qml b/src/controls/Styles/Desktop/ProgressBarStyle.qml new file mode 100644 index 00000000..834b8ab3 --- /dev/null +++ b/src/controls/Styles/Desktop/ProgressBarStyle.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + anchors.fill: parent + elementType: "progressbar" + // XXX: since desktop uses int instead of real, the progressbar + // range [0..1] must be stretched to a good precision + property int factor : 1000 + property int decimals: 3 + value: indeterminate ? 0 : control.value.toFixed(decimals) * factor // does indeterminate value need to be 1 on windows? + minimum: indeterminate ? 0 : control.minimumValue.toFixed(decimals) * factor + maximum: indeterminate ? 0 : control.maximumValue.toFixed(decimals) * factor + enabled: control.enabled + horizontal: control.orientation === Qt.Horizontal + hints: control.styleHints + contentWidth: horizontal ? 200 : 23 + contentHeight: horizontal ? 23 : 200 + } +} diff --git a/src/controls/Styles/Desktop/RadioButtonStyle.qml b/src/controls/Styles/Desktop/RadioButtonStyle.qml new file mode 100644 index 00000000..b41b959a --- /dev/null +++ b/src/controls/Styles/Desktop/RadioButtonStyle.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property RadioButton control: __control + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + + StyleItem { + id: styleitem + elementType: "radiobutton" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: macStyle ? -1 : 0 + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 2 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/src/controls/Styles/Desktop/ScrollViewStyle.qml b/src/controls/Styles/Desktop/ScrollViewStyle.qml new file mode 100644 index 00000000..ff03b3c3 --- /dev/null +++ b/src/controls/Styles/Desktop/ScrollViewStyle.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + id: root + + padding { + property int frameWidth: __styleitem.pixelMetric("defaultframewidth") + left: frameWidth + top: frameWidth + bottom: frameWidth + right: frameWidth + } + + property StyleItem __styleitem: StyleItem { elementType: "frame" } + + property Component frame: StyleItem { + id: styleitem + elementType: "frame" + sunken: true + visible: frameVisible + } + + property Component corner: StyleItem { elementType: "scrollareacorner" } + + readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars") + readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") + readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0 + + property Component __scrollbar: StyleItem { + readonly property bool isTransient: __styleitem.parent && __styleitem.transient + anchors.fill:parent + elementType: "scrollbar" + hover: activeControl != "none" + activeControl: "none" + sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed + minimum: __control.minimumValue + maximum: __control.maximumValue + value: __control.value + horizontal: __styleData.horizontal + enabled: __control.enabled + + implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent") + implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200 + } + +} diff --git a/src/controls/Styles/Desktop/SliderStyle.qml b/src/controls/Styles/Desktop/SliderStyle.qml new file mode 100644 index 00000000..e435205e --- /dev/null +++ b/src/controls/Styles/Desktop/SliderStyle.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property Item control: __control + property Component panel: StyleItem { + elementType: "slider" + sunken: control.pressed + implicitWidth: 200 + contentHeight: horizontal ? 22 : 200 + contentWidth: horizontal ? 200 : 22 + + maximum: control.maximumValue*100 + minimum: control.minimumValue*100 + step: control.stepSize*100 + value: control.__handlePos*100 + horizontal: control.orientation === Qt.Horizontal + enabled: control.enabled + hasFocus: control.activeFocus + hints: control.styleHints + activeControl: control.tickmarksEnabled ? "ticks" : "" + property int handleWidth: 15 + property int handleHeight: 15 + } + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } +} diff --git a/src/controls/Styles/Desktop/SpinBoxStyle.qml b/src/controls/Styles/Desktop/SpinBoxStyle.qml new file mode 100644 index 00000000..24f51427 --- /dev/null +++ b/src/controls/Styles/Desktop/SpinBoxStyle.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property SpinBox control: __control + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + padding { + top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0 + left: control.__panel ? control.__panel.leftPadding : 0 + right: control.__panel ? control.__panel.rightPadding : 0 + bottom: control.__panel ? control.__panel.bottomPadding : 0 + } + StyleItem {id: styleitem ; visible: false} + + property Component panel: Item { + id: style + + property rect upRect + property rect downRect + + property int horizontalTextAlignment: Qt.AlignLeft + property int verticalTextAlignment: Qt.AlignVCenter + + property color foregroundColor: __syspal.text + property color backgroundColor: __syspal.base + property color selectionColor: __syspal.highlight + property color selectedTextColor: __syspal.highlightedText + + property int topPadding: edit.anchors.topMargin + property int leftPadding: 2 + edit.anchors.leftMargin + property int rightPadding: 2 + edit.anchors.leftMargin + property int bottomPadding: edit.anchors.bottomMargin + + width: 100 + height: styleitem.implicitHeight + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + + Item { + id: edit + anchors.fill: parent + Rectangle { + color: "white" + anchors.fill: parent + anchors.margins: -1 + } + FocusFrame { + anchors.fill: parent + focusMargin:-6 + visible: spinbox.activeFocus && styleitem.styleHint("focuswidget") + } + } + + function updateRect() { + style.upRect = styleitem.subControlRect("up"); + style.downRect = styleitem.subControlRect("down"); + var inputRect = styleitem.subControlRect("edit"); + edit.anchors.topMargin = inputRect.y + edit.anchors.leftMargin = inputRect.x + edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin + edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin + } + + Component.onCompleted: updateRect() + onWidthChanged: updateRect() + onHeightChanged: updateRect() + + StyleItem { + id: styleitem + elementType: "spinbox" + anchors.fill: parent + sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed) + hover: control.hovered + hints: control.styleHints + hasFocus: control.activeFocus + enabled: control.enabled + value: (styleData.upPressed ? 1 : 0) | + (styleData.downPressed ? 1<<1 : 0) | + (styleData.upEnabled ? (1<<2) : 0) | + (styleData.downEnabled ? (1<<3) : 0) + contentWidth: styleData.contentWidth + contentHeight: styleData.contentHeight + } + } +} diff --git a/src/controls/Styles/Desktop/StatusBarStyle.qml b/src/controls/Styles/Desktop/StatusBarStyle.qml new file mode 100644 index 00000000..930ca773 --- /dev/null +++ b/src/controls/Styles/Desktop/StatusBarStyle.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles 1.0 +*/ +Style { + + padding.left: 4 + padding.right: 4 + padding.top: 3 + padding.bottom: 2 + + property Component panel: StyleItem { + implicitHeight: 16 + implicitWidth: 200 + anchors.fill: parent + elementType: "statusbar" + } +} diff --git a/src/controls/Styles/Desktop/TabViewStyle.qml b/src/controls/Styles/Desktop/TabViewStyle.qml new file mode 100644 index 00000000..51b70ea4 --- /dev/null +++ b/src/controls/Styles/Desktop/TabViewStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 +Style { + id: root + + property bool tabsMovable: false + property int tabsAlignment: __barstyle.styleHint("tabbaralignment") === "center" ? Qt.AlignHCenter : Qt.AlignLeft; + property int tabOverlap: __barstyle.pixelMetric("taboverlap"); + property int frameOverlap: __barstyle.pixelMetric("tabbaseoverlap"); + + property StyleItem __barstyle: StyleItem { + elementType: "tab" + properties: { "tabposition" : (control.tabPosition === Qt.TopEdge ? "Top" : "Bottom") } + visible: false + } + + property Component frame: StyleItem { + id: styleitem + anchors.fill: parent + anchors.topMargin: 1//stack.baseOverlap + z: style == "oxygen" ? 1 : 0 + elementType: "tabframe" + value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0 + minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0 + maximum: tabbarItem && tabsVisible ? tabbarItem.width : width + properties: { "selectedTabRect" : tabbarItem.__selectedTabRect, "orientation" : control.tabPosition } + hints: control.styleHints + Component.onCompleted: { + stack.frameWidth = styleitem.pixelMetric("defaultframewidth"); + stack.style = style; + } + } + + property Component tab: Item { + id: item + property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle" + property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : "" + property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom" + property int tabHSpace: __barstyle.pixelMetric("tabhspace"); + property int tabVSpace: __barstyle.pixelMetric("tabvspace"); + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (control.width + totalOverlap) / control.count + implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2) + implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) + + StyleItem { + id: styleitem + + elementType: "tab" + paintMargins: style === "mac" ? 0 : 2 + + anchors.fill: parent + anchors.topMargin: style === "mac" ? 2 : 0 + anchors.rightMargin: -paintMargins + anchors.bottomMargin: -1 + anchors.leftMargin: -paintMargins + (style === "mac" && selected ? -1 : 0) + properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos } + hints: control.styleHints + + selected: styleData.selected + text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace) + hover: styleData.hovered + hasFocus: tabbarItem.activeFocus && selected + } + } + + property Component leftCorner: null + property Component rightCorner: null +} diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml new file mode 100644 index 00000000..171678a3 --- /dev/null +++ b/src/controls/Styles/Desktop/TableViewStyle.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +ScrollViewStyle { + id: root + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + readonly property TableView control: __control + property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick") + property color textColor: __styleitem.textColor + property color backgroundColor: __syspal.base + property color highlightedTextColor: __styleitem.highlightedTextColor + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + property color highlightedTextColor: styleHint("highlightedTextColor") + elementType: "item" + visible: false + active: control.activeFocus + onActiveChanged: { + highlightedTextColor = styleHint("highlightedTextColor") + textColor = styleHint("textColor") + } + } + + property Component headerDelegate: StyleItem { + elementType: "header" + activeControl: itemSort + raised: true + sunken: styleData.pressed + text: styleData.value + hover: styleData.containsMouse + hints: control.styleHints + properties: {"headerpos": headerPosition} + property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; + property string headerPosition: control.columnCount === 1 ? "only" : + styleData.column === control.columnCount-1 ? "end" : + styleData.column === 0 ? "beginning" : "" + } + + property Component rowDelegate: StyleItem { + id: rowstyle + elementType: "itemrow" + activeControl: styleData.alternate ? "alternate" : "" + selected: styleData.selected ? true : false + height: Math.max(16, rowstyle.implicitHeight) + active: styleData.hasActiveFocus + } + + property Component itemDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: sizehint.paintedWidth + 16 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.leftMargin: 8 + font: __styleitem.font + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: styleData.textAlignment + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor + renderType: Text.NativeRendering + } + Text { + id: sizehint + font: label.font + text: styleData.value ? styleData.value : "" + visible: false + } + } +} + diff --git a/src/controls/Styles/Desktop/TextFieldStyle.qml b/src/controls/Styles/Desktop/TextFieldStyle.qml new file mode 100644 index 00000000..53282887 --- /dev/null +++ b/src/controls/Styles/Desktop/TextFieldStyle.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: textfieldstyle + elementType: "edit" + anchors.fill: parent + + sunken: true + hasFocus: control.activeFocus + hover: hovered + hints: control.styleHints + + SystemPalette { + id: syspal + colorGroup: control.enabled ? + SystemPalette.Active : + SystemPalette.Disabled + } + + property color textColor: syspal.text + property color placeholderTextColor: "darkGray" + property color selectionColor: syspal.highlight + property color selectedTextColor: syspal.highlightedText + + + property bool rounded: !!hints["rounded"] + property int topMargin: style === "mac" ? 3 : 2 + property int leftMargin: rounded ? 12 : 4 + property int rightMargin: leftMargin + property int bottomMargin: 2 + + contentWidth: 100 + // Form QLineEdit::sizeHint + contentHeight: Math.max(control.__contentHeight, 16) + + FocusFrame { + anchors.fill: parent + visible: textfield.activeFocus && textfieldstyle.styleHint("focuswidget") && !rounded + } + } +} diff --git a/src/controls/Styles/Desktop/ToolBarStyle.qml b/src/controls/Styles/Desktop/ToolBarStyle.qml new file mode 100644 index 00000000..c295f731 --- /dev/null +++ b/src/controls/Styles/Desktop/ToolBarStyle.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles 1.0 +*/ +Style { + + padding.left: 6 + padding.right: 6 + padding.top: 1 + padding.bottom: style.style === "mac" ? 1 : style.style === "fusion" ? 3 : 2 + + StyleItem { id: style ; visible: false} + + property Component panel: StyleItem { + id: toolbar + anchors.fill: parent + elementType: "toolbar" + } +} diff --git a/src/controls/Styles/Desktop/ToolButtonStyle.qml b/src/controls/Styles/Desktop/ToolButtonStyle.qml new file mode 100644 index 00000000..25529f11 --- /dev/null +++ b/src/controls/Styles/Desktop/ToolButtonStyle.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + + anchors.fill: parent + elementType: "toolbutton" + on: control.checkable && control.checked + sunken: control.pressed + raised: !(control.checkable && control.checked) && control.hovered + hover: control.hovered + hasFocus: control.activeFocus + hints: control.styleHints + text: control.text + + properties: { + "icon": control.__iconAction.__icon, + "position": control.__position + } + } +} |