aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/doc/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-09-28 15:49:49 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-20 10:33:34 +0000
commitf26f855e77e805bbe3b2c4b04a102441770ddb61 (patch)
tree1da7c2f6a5e75da5cb29ecd5e1f5c26e1d6630bc /src/imports/controls/doc/src
parentd6fbb1239950f392f3d569da7dde226e865b7bcd (diff)
Material: add snippets and screenshots for attached properties
Change-Id: I4b388f374452c6894fe47c4feb5779fea7776708 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/controls/doc/src')
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc83
1 files changed, 58 insertions, 25 deletions
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
index a90581ec..3ff9f5ea 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -79,28 +79,6 @@
\image qtquickcontrols2-material-attributes.png
- The following example illustrates how to create a red \e stop button with light text:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Material 2.0
-
- Button {
- text: "Stop"
- highlighted: true
-
- Material.accent: Material.Red
- Material.theme: Material.Dark
- }
- \endqml
- \li
- \image qtquickcontrols2-material-button.png
- \endtable
-
All attributes can be specified for any window or item, and they automatically
propagate to children in the same manner as \l {Control::font}{fonts}. In the
following example, the window and all three radio buttons appear in the dark
@@ -261,6 +239,17 @@
This attached property holds the accent color of the theme. The property
can be attached to any window or item. The value is propagated to children.
+ In the following example, the accent color of the highlighted button is
+ changed to \c Material.Orange:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-accent.qml 1
+ \li
+ \image qtquickcontrols2-material-accent.png
+ \endtable
+
The default value is \c Material.Pink.
\note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
@@ -276,6 +265,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the background color of the button is changed to
+ \c Material.Teal:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-background.qml 1
+ \li
+ \image qtquickcontrols2-material-background.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.elevation} {int} {material-elevation-attached-prop}
@@ -286,6 +286,18 @@
The default value is control-specific.
+ In the following example, the elevation of the pane is set to \c 6
+ in order to achieve the look of an
+ \l {https://material.google.com/components/cards.html}{elevated card}:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-elevation.qml 1
+ \li
+ \image qtquickcontrols2-material-elevation.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.foreground} {color} {material-foreground-attached-prop}
@@ -295,6 +307,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the foreground color of the button is set to \c
+ Material.Brown:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-foreground.qml 1
+ \li
+ \image qtquickcontrols2-material-foreground.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.primary} {color} {material-primary-attached-prop}
@@ -302,6 +325,8 @@
This attached property holds the primary color of the theme. The property
can be attached to any window or item. The value is propagated to children.
+ The primary color is used as the background color of ToolBar by default.
+
The default value is \c Material.Indigo.
\note Even though the primary can be any \l {colorbasictypedocs}{color}, it is
@@ -319,6 +344,17 @@
\value Material.Light Light theme (default)
\value Material.Dark Dark theme
+ In the following example, the theme for both the pane and the button is set
+ to \c Material.Dark:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-theme.qml 1
+ \li
+ \image qtquickcontrols2-material-theme.png
+ \endtable
+
\endstyleproperty
\section1 Attached Method Documentation
@@ -331,9 +367,6 @@
defaults to \c Material.Shade500.
\qml
- import QtQuick 2.0
- import QtQuick.Controls.Material 2.0
-
Rectangle {
color: Material.color(Material.Red)
}