diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-21 17:16:53 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-24 10:39:36 +0000 |
commit | 2349b299a9d18d1884067a6ee0fad55d1e2f8d38 (patch) | |
tree | 14b1fd435b943169eb29e68a6455779d0cd1a8b4 /src | |
parent | 31ed6f5235b841cce260d183eeb5c91d3eb8a93a (diff) |
Doc: add snippets and screenshots for the Universal attached properties
Ideas and descriptions shamelessly stolen from f26f855, which did the
same for the Material style.
Change-Id: Ibab47d1370c56de4104dc2bf549870335c639257
Task-number: QTBUG-55904
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png | bin | 0 -> 1079 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-universal-background.png | bin | 0 -> 1326 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png | bin | 0 -> 1027 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png | bin | 0 -> 1386 bytes | |||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml | 43 | ||||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml | 44 | ||||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml | 41 | ||||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml | 44 | ||||
-rw-r--r-- | src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc | 73 |
9 files changed, 219 insertions, 26 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png Binary files differnew file mode 100644 index 00000000..be1a4a89 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png Binary files differnew file mode 100644 index 00000000..c91ab14d --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png Binary files differnew file mode 100644 index 00000000..e06b573b --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png Binary files differnew file mode 100644 index 00000000..f299b853 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml new file mode 100644 index 00000000..afcfa87f --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 +import QtQuick.Controls.Universal 2.0 + +Pane { + padding: 10 + +//! [1] +Button { + text: qsTr("Button") + highlighted: true + Universal.accent: Universal.Orange +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml new file mode 100644 index 00000000..32a1b43b --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtQuick.Controls.Universal 2.0 + +Pane { + padding: 10 + +//! [1] +Pane { + Universal.background: Universal.Steel + + Button { + text: qsTr("Button") + } +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml new file mode 100644 index 00000000..6ca35d74 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtQuick.Controls.Universal 2.0 + +Pane { + padding: 10 + +//! [1] +Button { + text: qsTr("Button") + Universal.foreground: Universal.Pink +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml new file mode 100644 index 00000000..85e4a406 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtQuick.Controls.Universal 2.0 + +Pane { + padding: 10 + +//! [1] +Pane { + Universal.theme: Universal.Dark + + Button { + text: qsTr("Button") + } +} +//! [1] +} diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc index 02dc93c9..b8f7789b 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc @@ -78,28 +78,6 @@ \image qtquickcontrols2-universal-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.Universal 2.0 - - Button { - text: "Stop" - highlighted: true - - Universal.accent: Universal.Red - Universal.theme: Universal.Dark - } - \endqml - \li - \image qtquickcontrols2-universal-button.png - \endtable - Both 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 @@ -209,8 +187,21 @@ 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. + The default value is \c Universal.Cobalt. + + In the following example, the accent color of the highlighted button is + changed to \c Universal.Orange: + + \table + \row + \li + \snippet qtquickcontrols2-universal-accent.qml 1 + \li + \image qtquickcontrols2-universal-accent.png + \endtable + \note Even though the accent can be any \l {colorbasictypedocs}{color}, it is - recommended to use one of the \l {pre-defined Universal colors} that have been + recommended to use one of the \l {pre-defined Universal colors} that have been designed to work well with the rest of the Universal style palette. \endstyleproperty @@ -222,6 +213,17 @@ The default value is theme-specific (light or dark). + In the following example, the background color of the pane is changed to + \c Universal.Steel: + + \table + \row + \li + \snippet qtquickcontrols2-universal-background.qml 1 + \li + \image qtquickcontrols2-universal-background.png + \endtable + \endstyleproperty \styleproperty {Universal.foreground} {color} {universal-foreground-attached-prop} @@ -231,6 +233,17 @@ The default value is theme-specific (light or dark). + In the following example, the foreground color of the button is set to \c + Universal.Pink: + + \table + \row + \li + \snippet qtquickcontrols2-universal-foreground.qml 1 + \li + \image qtquickcontrols2-universal-foreground.png + \endtable + \styleproperty {Universal.theme} {enumeration} {universal-theme-attached-prop} \target universal-theme-attached-prop This attached property holds whether the theme is light or dark. The property @@ -240,6 +253,17 @@ \value Universal.Light Light theme (default) \value Universal.Dark Dark theme + In the following example, the theme for both the pane and the button is set + to \c Universal.Dark: + + \table + \row + \li + \snippet qtquickcontrols2-universal-theme.qml 1 + \li + \image qtquickcontrols2-universal-theme.png + \endtable + \endstyleproperty \section1 Attached Method Documentation @@ -250,9 +274,6 @@ \l {pre-defined Universal colors}{pre-defined Universal color}. \qml - import QtQuick 2.0 - import QtQuick.Controls.Universal 2.0 - Rectangle { color: Universal.color(Universal.Red) } |