summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-10-30 17:41:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-31 13:24:02 +0100
commitecd02a21cda5d39f6715a8b737ddf2ec70c056c3 (patch)
tree4d8c2f63f3dd231f9a757337679108ebead7f689
parentfd8d7261cc25a7a2efcf42c59f9f11d0280e4383 (diff)
Expose ToolBarStyle and StatusBarStyle
As they are rather basic, I think we should simply expose them rather than explain why people should use rectangles. Change-Id: I8ef79452fb27ffa0ef11bb477c687033996b4a5e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/controls/Private/qmldir2
-rw-r--r--src/controls/Styles/Base/StatusBarStyle.qml56
-rw-r--r--src/controls/Styles/Base/ToolBarStyle.qml50
-rw-r--r--src/controls/Styles/qmldir2
-rw-r--r--tests/auto/controls/data/tst_styles.qml4
5 files changed, 95 insertions, 19 deletions
diff --git a/src/controls/Private/qmldir b/src/controls/Private/qmldir
index c8c6f46b3..f099634c2 100644
--- a/src/controls/Private/qmldir
+++ b/src/controls/Private/qmldir
@@ -15,8 +15,6 @@ TableViewSelection 1.0 TableViewSelection.qml
FastGlow 1.0 FastGlow.qml
SourceProxy 1.0 SourceProxy.qml
GroupBoxStyle 1.0 ../Styles/Base/GroupBoxStyle.qml
-ToolBarStyle 1.0 ../Styles/Base/ToolBarStyle.qml
-StatusBarStyle 1.0 ../Styles/Base/StatusBarStyle.qml
ToolButtonStyle 1.0 ../Styles/Base/ToolButtonStyle.qml
MenuContentItem 1.0 MenuContentItem.qml
MenuContentScroller 1.0 MenuContentScroller.qml
diff --git a/src/controls/Styles/Base/StatusBarStyle.qml b/src/controls/Styles/Base/StatusBarStyle.qml
index a210650f7..aa8f6d6e9 100644
--- a/src/controls/Styles/Base/StatusBarStyle.qml
+++ b/src/controls/Styles/Base/StatusBarStyle.qml
@@ -43,19 +43,55 @@ import QtQuick.Controls.Private 1.0
/*!
\qmltype StatusBarStyle
- \internal
- \ingroup applicationwindowstyling
\inqmlmodule QtQuick.Controls.Styles
- \since 5.1
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for StatusBar
+
+ The status bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ StatusBar {
+ style: StatusBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitHeight: 16
+ implicitWidth: 200
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+ Rectangle {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+ }
+ }
+ \endqml
*/
+
Style {
- padding.left: 3
- padding.right: 3
- padding.top: 3
- padding.bottom: 2
+ /*! The content padding inside the status bar. */
+ padding {
+ left: 3
+ right: 3
+ top: 3
+ bottom: 2
+ }
- property Component panel: Rectangle {
+ /*! This defines the background of the tool bar. */
+ property Component background: Rectangle {
implicitHeight: 16
implicitWidth: 200
@@ -71,4 +107,8 @@ Style {
color: "#999"
}
}
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
}
diff --git a/src/controls/Styles/Base/ToolBarStyle.qml b/src/controls/Styles/Base/ToolBarStyle.qml
index 51fe8ca74..ca5d93fba 100644
--- a/src/controls/Styles/Base/ToolBarStyle.qml
+++ b/src/controls/Styles/Base/ToolBarStyle.qml
@@ -43,18 +43,50 @@ import QtQuick.Controls.Private 1.0
/*!
\qmltype ToolBarStyle
- \internal
- \ingroup applicationwindowstyling
\inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for ToolBar
+
+ The tool bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ ToolBar {
+ style: ToolBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ border.color: "#999"
+ gradient: Gradient {
+ GradientStop { position: 0 ; color: "#fff" }
+ GradientStop { position: 1 ; color: "#eee" }
+ }
+ }
+ }
+ }
+ \endqml
*/
+
Style {
- padding.left: 6
- padding.right: 6
- padding.top: 3
- padding.bottom: 3
+ /*! The content padding inside the tool bar. */
+ padding {
+ left: 6
+ right: 6
+ top: 3
+ bottom: 3
+ }
- property Component panel: Item {
+ /*! This defines the background of the tool bar. */
+ property Component background: Item {
implicitHeight: 40
implicitWidth: 200
Rectangle {
@@ -71,4 +103,8 @@ Style {
}
}
}
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
}
diff --git a/src/controls/Styles/qmldir b/src/controls/Styles/qmldir
index 8e53b6ba0..5cd368ac8 100644
--- a/src/controls/Styles/qmldir
+++ b/src/controls/Styles/qmldir
@@ -13,3 +13,5 @@ TabViewStyle 1.0 Base/TabViewStyle.qml
TableViewStyle 1.0 Base/TableViewStyle.qml
TextAreaStyle 1.1 Base/TextAreaStyle.qml
TextFieldStyle 1.0 Base/TextFieldStyle.qml
+ToolBarStyle 1.0 Base/ToolBarStyle.qml
+StatusBarStyle 1.0 Base/StatusBarStyle.qml
diff --git a/tests/auto/controls/data/tst_styles.qml b/tests/auto/controls/data/tst_styles.qml
index a458a78d0..c1af406dc 100644
--- a/tests/auto/controls/data/tst_styles.qml
+++ b/tests/auto/controls/data/tst_styles.qml
@@ -118,14 +118,14 @@ Item {
function test_createToolBarStyle() {
var control = Qt.createQmlObject(
- 'import QtQuick 2.1; import QtQuick.Controls 1.1; import QtQuick.Controls.Private 1.0; \
+ 'import QtQuick 2.1; import QtQuick.Controls 1.1; import QtQuick.Controls.Styles 1.1; \
Rectangle { width: 50; height: 50; property Component style: ToolBarStyle {}}'
, container, '')
}
function test_createStatusBarStyle() {
var control = Qt.createQmlObject(
- 'import QtQuick 2.1; import QtQuick.Controls 1.1; import QtQuick.Controls.Private 1.0; \
+ 'import QtQuick 2.1; import QtQuick.Controls 1.1; import QtQuick.Controls.Styles 1.1; \
Rectangle { width: 50; height: 50; property Component style: StatusBarStyle {}}'
, container, '')
}