diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/controls/ComboBox.qml | 10 | ||||
| -rw-r--r-- | src/controls/GroupBox.qml | 4 | ||||
| -rw-r--r-- | src/controls/ScrollView.qml | 33 | ||||
| -rw-r--r-- | src/controls/StatusBar.qml | 13 | ||||
| -rw-r--r-- | src/controls/TableView.qml | 103 | ||||
| -rw-r--r-- | src/controls/ToolBar.qml | 13 | ||||
| -rw-r--r-- | src/styles/CheckBoxStyle.qml | 2 | ||||
| -rw-r--r-- | src/styles/ComboBoxStyle.qml | 23 | ||||
| -rw-r--r-- | src/styles/Desktop/ComboBoxStyle.qml | 6 | ||||
| -rw-r--r-- | src/styles/Desktop/ScrollViewStyle.qml | 61 | ||||
| -rw-r--r-- | src/styles/Desktop/StatusBarStyle.qml | 57 | ||||
| -rw-r--r-- | src/styles/Desktop/TableViewStyle.qml | 103 | ||||
| -rw-r--r-- | src/styles/Desktop/ToolBarStyle.qml | 20 | ||||
| -rw-r--r-- | src/styles/GroupBoxStyle.qml | 12 | ||||
| -rw-r--r-- | src/styles/ScrollViewStyle.qml | 61 | ||||
| -rw-r--r-- | src/styles/SliderStyle.qml | 2 | ||||
| -rw-r--r-- | src/styles/StatusBarStyle.qml | 69 | ||||
| -rw-r--r-- | src/styles/TableViewStyle.qml | 103 | ||||
| -rw-r--r-- | src/styles/ToolBarStyle.qml | 28 | ||||
| -rw-r--r-- | src/styles/ToolButtonStyle.qml | 41 | ||||
| -rw-r--r-- | src/styles/qmldir | 3 | ||||
| -rw-r--r-- | src/styles/styles.pro | 6 |
22 files changed, 609 insertions, 164 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index f302aef84..53ff46e34 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -104,16 +104,10 @@ Control { onPressedChanged: if (pressed) popup.show() } - StyleItem { - id: styleItem - elementType: "comboboxitem" - visible: false - } - Component.onCompleted: { if (currentIndex === -1) currentIndex = 0 - if (styleItem.style == "mac") { + if (Qt.platform.os === "mac") { popup.x -= 10 popup.y += 4 } @@ -139,7 +133,7 @@ Control { property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height __minimumWidth: comboBox.width __visualItem: comboBox - __font: styleItem.font + __font: __panel.font property ExclusiveGroup eg: ExclusiveGroup { id: eg } diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index 91c358814..d67dc216a 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -138,7 +138,7 @@ Item { property real contentHeight: content.childrenRect.height /*! \internal */ - property Component __style: Qt.createComponent(Settings.THEME_PATH + "/GroupBoxStyle.qml", groupbox) + property Component style: Qt.createComponent(Settings.THEME_PATH + "/GroupBoxStyle.qml", groupbox) /*! \internal */ default property alias data: content.data @@ -166,7 +166,7 @@ Item { onLoaded: item.z = -1 Loader { id: styleLoader - sourceComponent: __style + sourceComponent: groupbox.style } } diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 01b9cd3c6..a218b5468 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -41,6 +41,8 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 +import "Styles/Settings.js" as Settings /*! \qmltype ScrollView @@ -137,6 +139,11 @@ FocusScope { property alias horizontalScrollBar: scroller.horizontalScrollBar /*! \internal */ property alias verticalScrollBar: scroller.verticalScrollBar + /*! \internal */ + property Component style: Qt.createComponent(Settings.THEME_PATH + "/ScrollViewStyle.qml", root) + + /* \internal */ + property Style __style: styleLoader.item activeFocusOnTab: true @@ -159,6 +166,16 @@ FocusScope { property Flickable flickableItem + Loader { + id: styleLoader + sourceComponent: style + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + property alias control: root + } + Binding { target: flickableItem property: "contentHeight" @@ -253,19 +270,17 @@ FocusScope { ScrollViewHelper { id: scroller anchors.fill: parent - property int frameWidth: frameVisible ? styleitem.pixelMetric("defaultframewidth") : 0 - property bool outerFrame: !frameVisible || !styleitem.styleHint("frameOnlyAroundContents") - property int scrollBarSpacing: outerFrame ? 0 : styleitem.pixelMetric("scrollbarspacing") + property int frameWidth: frameVisible ? __style.defaultFrameWidth : 0 + property bool outerFrame: !frameVisible || !(__style ? __style.frameOnlyAroundContents : 0) + property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.scrollBarSpacing : 0) property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ? verticalScrollBar.width + scrollBarSpacing : 0 property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ? horizontalScrollBar.height + scrollBarSpacing : 0 - StyleItem { - id: styleitem - elementType: "frame" - sunken: true - visible: frameVisible + Loader { + id: frameLoader + sourceComponent: __style ? __style.frame : null anchors.fill: parent anchors.rightMargin: scroller.outerFrame ? 0 : scroller.verticalScrollbarOffset anchors.bottomMargin: scroller.outerFrame ? 0 : scroller.horizontalScrollbarOffset @@ -273,7 +288,7 @@ FocusScope { Item { id: viewportItem - anchors.fill: styleitem + anchors.fill: frameLoader anchors.margins: scroller.frameWidth anchors.rightMargin: scroller.frameWidth + (scroller.outerFrame ? scroller.verticalScrollbarOffset : 0) anchors.bottomMargin: scroller.frameWidth + (scroller.outerFrame ? scroller.horizontalScrollbarOffset : 0) diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index b3987cb4a..02ac5ab82 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import "Styles/Settings.js" as Settings /*! \qmltype StatusBar @@ -67,12 +68,14 @@ import QtQuick.Controls.Private 1.0 Item { id: statusbar - implicitHeight: 20 - implicitWidth: parent ? parent.width : style.implicitWidth activeFocusOnTab: false - StyleItem { - id: style + Accessible.role: Accessible.StatusBar + implicitWidth: parent ? parent.width : loader.item ? loader.item.implicitHeight : 0 + implicitHeight: loader.item ? loader.item.implicitHeight : 0 + property Component style: Qt.createComponent(Settings.THEME_PATH + "/StatusBarStyle.qml", statusbar) + Loader { + id: loader anchors.fill: parent - elementType: "statusbar" + sourceComponent: style } } diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 1809566f3..1dc5602c4 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import "Styles/Settings.js" as Settings /*! \qmltype TableView @@ -145,7 +146,7 @@ ScrollView { } } \endcode */ - property Component itemDelegate: standardDelegate + property Component itemDelegate: __style ? __style.standardDelegate : null /*! This property defines a delegate to draw a row. @@ -156,7 +157,7 @@ ScrollView { \li index - the index of the row \endlist */ - property Component rowDelegate: rowDelegate + property Component rowDelegate: __style ? __style.rowDelegate : null /*! \qmlproperty color TableView::backgroundColor @@ -165,7 +166,7 @@ ScrollView { property alias backgroundColor: colorRect.color /*! This property defines a delegate to draw a header. */ - property Component headerDelegate: headerDelegate + property Component headerDelegate: __style ? __style.headerDelegate : null /*! Index of the current sort column. The default value is \c {0}. */ @@ -223,13 +224,17 @@ ScrollView { Emitted when a new row is selected by the user. */ signal activated + + style: Qt.createComponent(Settings.THEME_PATH + "/TableViewStyle.qml", root) + + Accessible.role: Accessible.Table width: 200 height: 200 frameVisible: true - __scrollBarTopMargin: styleitem.style == "mac" ? headerrow.height : 0 + __scrollBarTopMargin: Qt.platform.os === "mac" ? headerrow.height : 0 /*! \internal */ function __decrementCurrentIndex() { @@ -266,12 +271,6 @@ ScrollView { z: -1 } - StyleItem { - id: itemstyle - elementType: "item" - visible: false - } - MouseArea { id: mousearea @@ -388,6 +387,7 @@ ScrollView { property var model: listView.model property var modelData: rowitem.itemModelData property var itemModel: rowitem.itemModel + property bool hasFocus: root.activeFocus } Row { id: row @@ -409,7 +409,7 @@ ScrollView { property var itemValue: __getValue() property bool itemSelected: rowitem.ListView.isCurrentItem - property color itemTextColor: itemSelected ? rowstyleitem.highlightedTextColor : rowstyleitem.textColor + property color itemTextColor: itemSelected ? __style.highlightedTextColor : __style.textColor property int rowIndex: rowitem.rowIndex property int columnIndex: index property int itemElideMode: columns[index].elideMode @@ -606,87 +606,6 @@ ScrollView { visible: root.columns.length z:-1 } - - Component { - id: standardDelegate - Item { - height: Math.max(16, styleitem.implicitHeight) - property int implicitWidth: sizehint.paintedWidth + 4 - Text { - id: label - objectName: "label" - width: parent.width - anchors.margins: 6 - font: itemstyle.font - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: itemTextAlignment - anchors.verticalCenter: parent.verticalCenter - elide: itemElideMode - text: itemValue != undefined ? itemValue : "" - color: itemTextColor - renderType: Text.NativeRendering - } - Text { - id: sizehint - font: label.font - text: itemValue ? itemValue : "" - visible: false - } - } - } - - Component { - id: nativeDelegate - // This gives more native styling, but might be less performant - StyleItem { - elementType: "item" - text: itemValue - selected: itemSelected - active: root.activeFocus - } - } - - Component { - id: headerDelegate - StyleItem { - elementType: "header" - activeControl: itemSort - raised: true - sunken: itemPressed - text: itemValue - hover: itemContainsMouse - hints: itemPosition - } - } - - Component { - id: rowDelegate - StyleItem { - id: rowstyle - elementType: "itemrow" - activeControl: alternateBackground ? "alternate" : "" - selected: rowSelected ? true : false - height: Math.max(16, styleitem.implicitHeight) - active: root.activeFocus - } - } - - StyleItem { - id: styleitem - elementType: "header" - visible:false - contentWidth: 16 - contentHeight: font.pixelSize - } - - StyleItem { - id: rowstyleitem - property color textColor: styleHint("textColor") - property color highlightedTextColor: styleHint("highlightedTextColor") - elementType: "item" - visible: false - } } } } diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index 5463eb3cc..ffbf16e16 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import "Styles/Settings.js" as Settings /*! \qmltype ToolBar @@ -69,13 +70,15 @@ import QtQuick.Controls.Private 1.0 */ Item { - implicitHeight: Math.max(childrenRect.height, toolbar.implicitHeight) - implicitWidth: parent ? parent.width : toolbar.implicitWidth + id: toolbar activeFocusOnTab: false Accessible.role: Accessible.ToolBar - StyleItem { - id: toolbar + implicitWidth: loader.item ? loader.item.implicitWidth : 0 + implicitHeight: loader.item ? loader.item.implicitHeight : 0 + property Component style: Qt.createComponent(Settings.THEME_PATH + "/ToolBarStyle.qml", toolbar) + Loader { + id: loader anchors.fill: parent - elementType: "toolbar" + sourceComponent: style } } diff --git a/src/styles/CheckBoxStyle.qml b/src/styles/CheckBoxStyle.qml index 77b6c60dc..3c1278934 100644 --- a/src/styles/CheckBoxStyle.qml +++ b/src/styles/CheckBoxStyle.qml @@ -79,7 +79,7 @@ Style { } property Component panel: Item { - implicitWidth: row.width + implicitWidth: row.width + 4 implicitHeight: row.height property var _cref: control diff --git a/src/styles/ComboBoxStyle.qml b/src/styles/ComboBoxStyle.qml index 7a2da9607..e0cae7194 100644 --- a/src/styles/ComboBoxStyle.qml +++ b/src/styles/ComboBoxStyle.qml @@ -48,7 +48,10 @@ import QtQuick.Controls.Styles 1.0 Style { property Component panel: Rectangle { - id: styleitem + + property int popup: 0 + property font font: textitem.font + implicitWidth: 200 implicitHeight: 20 @@ -61,10 +64,26 @@ Style { border.color: "#aaa" Text { + id: textitem anchors.centerIn: parent text: control.currentText } } - property Component popupStyle: MenuStyle { } + property Component dropDownStyle: MenuStyle { } + + property Component popupStyle: Style { + + property Component frame: Rectangle { + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 + border.color: "#777" + } + + property Component menuItem: Rectangle { + implicitWidth: textItem.contentWidth + implicitHeight: textItem.contentHeight + border.color: "#777" + } + } } diff --git a/src/styles/Desktop/ComboBoxStyle.qml b/src/styles/Desktop/ComboBoxStyle.qml index 33c3d6b23..720b659f7 100644 --- a/src/styles/Desktop/ComboBoxStyle.qml +++ b/src/styles/Desktop/ComboBoxStyle.qml @@ -44,6 +44,12 @@ import QtQuick.Controls.Private 1.0 Style { property Component panel: Item { property int popup: styleItem.styleHint("comboboxpopup") + property font font: itemstyle.font + StyleItem { + id: itemstyle + elementType: "comboboxitem" + visible: false + } implicitWidth: 115 implicitHeight: styleItem.implicitHeight diff --git a/src/styles/Desktop/ScrollViewStyle.qml b/src/styles/Desktop/ScrollViewStyle.qml new file mode 100644 index 000000000..375579f84 --- /dev/null +++ b/src/styles/Desktop/ScrollViewStyle.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 +import QtQuick.Controls.Styles 1.0 + +Style { + id: root + + property bool frameOnlyAroundContents: __styleitem.styleHint("frameOnlyAroundContents") + property int scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") + property int defaultFrameWidth: __styleitem.pixelMetric("defaultframewidth") + + property StyleItem __styleitem: StyleItem { elementType: "frame" } + + property Component frame: StyleItem { + id: styleitem + elementType: "frame" + sunken: true + visible: frameVisible + } + +} diff --git a/src/styles/Desktop/StatusBarStyle.qml b/src/styles/Desktop/StatusBarStyle.qml new file mode 100644 index 000000000..6921a2fe5 --- /dev/null +++ b/src/styles/Desktop/StatusBarStyle.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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 +*/ +Item { + implicitHeight: 20 + implicitWidth: parent ? parent.width : style.implicitWidth + StyleItem { + id: style + anchors.fill: parent + elementType: "statusbar" + } +} diff --git a/src/styles/Desktop/TableViewStyle.qml b/src/styles/Desktop/TableViewStyle.qml new file mode 100644 index 000000000..d572968eb --- /dev/null +++ b/src/styles/Desktop/TableViewStyle.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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 color textColor: __styleitem.styleHint("textColor") + property color highlightedTextColor: __styleitem.styleHint("highlightedTextColor") + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + property color highlightedTextColor: styleHint("highlightedTextColor") + elementType: "item" + visible: false + } + + property Component headerDelegate: StyleItem { + elementType: "header" + activeControl: itemSort + raised: true + sunken: itemPressed + text: itemValue + hover: itemContainsMouse + hints: itemPosition + } + + property Component rowDelegate: StyleItem { + id: rowstyle + elementType: "itemrow" + activeControl: alternateBackground ? "alternate" : "" + selected: rowSelected ? true : false + height: Math.max(16, rowstyle.implicitHeight) + active: hasFocus + } + + property Component standardDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: sizehint.paintedWidth + 4 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.margins: 6 + font: __styleitem.font + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: itemTextAlignment + anchors.verticalCenter: parent.verticalCenter + elide: itemElideMode + text: itemValue != undefined ? itemValue : "" + color: itemTextColor + renderType: Text.NativeRendering + } + Text { + id: sizehint + font: label.font + text: itemValue ? itemValue : "" + visible: false + } + } +} + diff --git a/src/styles/Desktop/ToolBarStyle.qml b/src/styles/Desktop/ToolBarStyle.qml index 52a4d09e8..4c7e036ec 100644 --- a/src/styles/Desktop/ToolBarStyle.qml +++ b/src/styles/Desktop/ToolBarStyle.qml @@ -41,11 +41,17 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -StyleItem { - id: toolbar - width: parent ? parent.width : 200 - height: implicitHeight - elementType: "toolbar" - - Accessible.role: Accessible.ToolBar +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles 1.0 +*/ +Item { + implicitHeight: Math.max(childrenRect.height, toolbar.implicitHeight) + implicitWidth: parent ? parent.width : toolbar.implicitWidth + StyleItem { + id: toolbar + anchors.fill: parent + elementType: "toolbar" + } } diff --git a/src/styles/GroupBoxStyle.qml b/src/styles/GroupBoxStyle.qml index ba5010d46..7e12791dd 100644 --- a/src/styles/GroupBoxStyle.qml +++ b/src/styles/GroupBoxStyle.qml @@ -48,14 +48,20 @@ import QtQuick.Controls.Styles 1.0 */ Style { property int margin: 8 - property Component panel: Item { - implicitWidth: Math.max(200, contentWidth + 30) - implicitHeight: contentHeight + + property Component panel: Rectangle { + implicitWidth: control.contentWidth + 2 * margin + implicitHeight: control.contentHeight + 2 * margin + 16 + Text { anchors.top: parent.top anchors.left: parent.left anchors.margins: 4 text: control.title } + border.color: "#999" + border.width: 1 + color: "transparent" + radius: 4 } } diff --git a/src/styles/ScrollViewStyle.qml b/src/styles/ScrollViewStyle.qml new file mode 100644 index 000000000..9edb50282 --- /dev/null +++ b/src/styles/ScrollViewStyle.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 +import QtQuick.Controls.Styles 1.0 + +Style { + id: root + + property bool frameOnlyAroundContents: __styleitem.styleHint("frameOnlyAroundContents") + property int scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") + property int defaultFrameWidth: __styleitem.pixelMetric("defaultframewidth") + + property StyleItem __styleitem: StyleItem { elementType: "frame" } + + property Component frame: StyleItem { + id: styleitem + elementType: "frame" + sunken: true + visible: control.frameVisible + } + +} diff --git a/src/styles/SliderStyle.qml b/src/styles/SliderStyle.qml index 2f618a179..b54c2ba9a 100644 --- a/src/styles/SliderStyle.qml +++ b/src/styles/SliderStyle.qml @@ -68,7 +68,7 @@ Style { property Component background: Rectangle { anchors.verticalCenter: parent.verticalCenter - implicitWidth: 100 + implicitWidth: 200 implicitHeight: 6 gradient: Gradient { diff --git a/src/styles/StatusBarStyle.qml b/src/styles/StatusBarStyle.qml new file mode 100644 index 000000000..02ef32aff --- /dev/null +++ b/src/styles/StatusBarStyle.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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 +*/ +Item { + implicitHeight: 42 + implicitWidth: 200 + + Rectangle { + + anchors.fill: parent + + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: "#999" + } + } +} diff --git a/src/styles/TableViewStyle.qml b/src/styles/TableViewStyle.qml new file mode 100644 index 000000000..20352bd23 --- /dev/null +++ b/src/styles/TableViewStyle.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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 + +ScrollViewStyle { + id: root + + property color textColor: "black" + property color highlightedTextColor: "white" + + property Component headerDelegate: Rectangle { + color: "white" + implicitHeight: 16 + implicitWidth: 80 + Text { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + anchors.leftMargin: 4 + text: itemValue + renderType: Text.NativeRendering + } + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: "#bbb" + } + } + + property Component rowDelegate: Rectangle { + color: rowSelected ? "lightsteelblue" : alternateBackground ? "#eee" : "white" + implicitHeight: 20 + implicitWidth: 80 + } + + property Component standardDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: sizehint.paintedWidth + 4 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.margins: 6 + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: itemTextAlignment + anchors.verticalCenter: parent.verticalCenter + elide: itemElideMode + text: itemValue != undefined ? itemValue : "" + color: itemTextColor + renderType: Text.NativeRendering + } + Text { + id: sizehint + font: label.font + text: itemValue ? itemValue : "" + visible: false + } + } +} + diff --git a/src/styles/ToolBarStyle.qml b/src/styles/ToolBarStyle.qml index 450304ed0..aa21195ac 100644 --- a/src/styles/ToolBarStyle.qml +++ b/src/styles/ToolBarStyle.qml @@ -46,23 +46,19 @@ import QtQuick.Controls 1.0 \inqmlmodule QtQuick.Controls.Styles 1.0 */ Item { - - property int __overlap : 1 - property string position: "Top" - property string tabBarAlignment: "Center" - property int tabOverlap: 1 - property int tabBaseOverlap: 1 - property int tabHSpace: 0 - property int tabVSpace: 0 - - property Component tab: Rectangle { - id: styleitem - implicitWidth: 200 - implicitHeight: 40 + implicitHeight: 42 + implicitWidth: 200 + Rectangle { + anchors.fill: parent gradient: Gradient{ - GradientStop{color: "lightgray" ; position: 0} - GradientStop{color: "lightgray" ; position: 1} + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: "#999" } - border.color: "#aaa" } } diff --git a/src/styles/ToolButtonStyle.qml b/src/styles/ToolButtonStyle.qml index 13b9813c7..3734f3a6f 100644 --- a/src/styles/ToolButtonStyle.qml +++ b/src/styles/ToolButtonStyle.qml @@ -45,18 +45,33 @@ import QtQuick.Controls 1.0 \internal \inqmlmodule QtQuick.Controls.Styles 1.0 */ -Rectangle { - id: styleitem - implicitWidth: 32 - implicitHeight: 32 - gradient: Gradient{ - GradientStop{color: control.pressed ? "lightgray" : "white" ; position: 0} - GradientStop{color: control.pressed ? "lightgray" : "lightgray" ; position: 1} - } - radius:4 - border.color: "#aaa" - Text { - anchors.centerIn: parent - text: control.text +Style { + property Component panel: Item { + id: styleitem + implicitWidth: 36 + implicitHeight: 36 + + Rectangle { + anchors.fill: parent + visible: control.pressed + gradient: Gradient{ + GradientStop{color: control.pressed ? "lightgray" : "white" ; position: 0} + GradientStop{color: control.pressed ? "lightgray" : "lightgray" ; position: 1} + } + radius:4 + border.color: "#aaa" + } + Text { + id: label + visible: icon.status != Image.Ready + anchors.centerIn: parent + text: control.text + } + Image { + id: icon + anchors.centerIn: parent + source: control.iconSource + + } } } diff --git a/src/styles/qmldir b/src/styles/qmldir index eee1abd17..8b4b9c2cd 100644 --- a/src/styles/qmldir +++ b/src/styles/qmldir @@ -5,11 +5,14 @@ ComboBoxStyle 1.0 ComboBoxStyle.qml GroupBoxStyle 1.0 GroupBoxStyle.qml ProgressBarStyle 1.0 ProgressBarStyle.qml RadioButtonStyle 1.0 RadioButtonStyle.qml +ScrollViewStyle 1.0 ScrollViewStyle.qml ScrollBarStyle 1.0 ScrollBarStyle.qml SliderStyle 1.0 SliderStyle.qml SpinBoxStyle 1.0 SpinBoxStyle.qml +StatusBarStyle 1.0 StatusBarStyle.qml TabStyle 1.0 TabStyle.qml TabViewStyle 1.0 TabViewStyle.qml +TableViewStyle 1.0 TableViewStyle.qml TextAreaStyle 1.0 TextAreaStyle.qml TextFieldStyle 1.0 TextFieldStyle.qml ToolBarStyle 1.0 ToolBarStyle.qml diff --git a/src/styles/styles.pro b/src/styles/styles.pro index f0d44f6a9..06bf83cb8 100644 --- a/src/styles/styles.pro +++ b/src/styles/styles.pro @@ -11,9 +11,12 @@ QML_FILES = \ RadioButtonStyle.qml \ ScrollBarStyle.qml \ Settings.js \ + ScrollViewStyle.qml\ SliderStyle.qml \ SpinBoxStyle.qml \ Style.qml \ + StatusBarStyle.qml \ + TableViewStyle.qml \ TabViewStyle.qml \ TextFieldStyle.qml \ ToolBarStyle.qml \ @@ -29,10 +32,13 @@ QML_FILES += \ Desktop/MenuStyle.qml \ Desktop/ProgressBarStyle.qml \ Desktop/RadioButtonStyle.qml \ + Desktop/ScrollViewStyle.qml \ Desktop/ScrollBarStyle.qml \ Desktop/SliderStyle.qml \ Desktop/SpinBoxStyle.qml \ + Desktop/StatusBarStyle.qml\ Desktop/TabViewStyle.qml \ + Desktop/TableViewStyle.qml \ Desktop/TextFieldStyle.qml \ Desktop/ToolBarStyle.qml \ Desktop/ToolButtonStyle.qml |
