From f26f855e77e805bbe3b2c4b04a102441770ddb61 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 28 Sep 2016 15:49:49 +0200 Subject: Material: add snippets and screenshots for attached properties Change-Id: I4b388f374452c6894fe47c4feb5779fea7776708 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi --- .../images/qtquickcontrols2-material-accent.png | Bin 0 -> 1633 bytes .../qtquickcontrols2-material-background.png | Bin 0 -> 1883 bytes .../images/qtquickcontrols2-material-button.png | Bin 1272 -> 0 bytes .../images/qtquickcontrols2-material-elevation.png | Bin 0 -> 3087 bytes .../qtquickcontrols2-material-foreground.png | Bin 0 -> 1726 bytes .../doc/images/qtquickcontrols2-material-theme.png | Bin 0 -> 2002 bytes .../snippets/qtquickcontrols2-material-accent.qml | 43 +++++++++++ .../qtquickcontrols2-material-background.qml | 42 +++++++++++ .../qtquickcontrols2-material-elevation.qml | 51 +++++++++++++ .../qtquickcontrols2-material-foreground.qml | 41 ++++++++++ .../snippets/qtquickcontrols2-material-theme.qml | 44 +++++++++++ .../doc/src/qtquickcontrols2-material.qdoc | 83 ++++++++++++++------- 12 files changed, 279 insertions(+), 25 deletions(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-accent.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-background.png delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-button.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-material-theme.png create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png new file mode 100644 index 00000000..be0c8212 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-background.png b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png new file mode 100644 index 00000000..132fb538 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-button.png b/src/imports/controls/doc/images/qtquickcontrols2-material-button.png deleted file mode 100644 index 5181d8b1..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-material-button.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png new file mode 100644 index 00000000..38c6dc00 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png new file mode 100644 index 00000000..122f7f9b Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png new file mode 100644 index 00000000..7109f57f Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png differ diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml new file mode 100644 index 00000000..5238d876 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-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.Material 2.0 + +Pane { + padding: 4 + +//! [1] +Button { + text: qsTr("Button") + highlighted: true + Material.accent: Material.Orange +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml new file mode 100644 index 00000000..264d5d28 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** 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.Material 2.0 + +Pane { + padding: 4 + +//! [1] +Button { + text: qsTr("Button") + highlighted: true + Material.background: Material.Teal +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml new file mode 100644 index 00000000..3ce1a722 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** 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.Material 2.0 + +Pane { + contentWidth: 120 + contentHeight: 120 + padding: 10 + bottomPadding: 20 + +//! [1] +Pane { + width: 120 + height: 120 + + Material.elevation: 6 + + Label { + text: qsTr("I'm a card!") + anchors.centerIn: parent + } +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml new file mode 100644 index 00000000..1fe96121 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-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.Material 2.0 + +Pane { + padding: 4 + +//! [1] +Button { + text: qsTr("Button") + Material.foreground: Material.Pink +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml new file mode 100644 index 00000000..6bd91d5d --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-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.Material 2.0 + +Pane { + padding: 10 + +//! [1] +Pane { + Material.theme: Material.Dark + + Button { + text: qsTr("Button") + } +} +//! [1] +} 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) } -- cgit v1.2.3 From 6f7d739bd6de6833ee049b8ba424c79e88c42ad7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Oct 2016 19:26:39 +0200 Subject: Material: sync ComboBox with Button ComboBox is modeled after Material design's drop-down Button, but it was never updated to have the same external padding that was added to the Material style Button. Both should have the same visual size to make them look sensible when laid out next to each other. Change-Id: I350f4acb2ea29ba292dbfaea874c348ae57750a2 Reviewed-by: Mitch Curtis --- src/imports/controls/material/ComboBox.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index 05981baa..183bcef9 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -54,7 +54,10 @@ T.ComboBox { baselineOffset: contentItem.y + contentItem.baselineOffset spacing: 6 - padding: 16 + // external vertical padding is 6 (to increase touch area) + padding: 12 + leftPadding: padding - 4 + rightPadding: padding - 4 // Don't use toolTextColor, as that is often white when we have a white background. Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground @@ -89,6 +92,9 @@ T.ComboBox { implicitWidth: 120 implicitHeight: 48 + // external vertical padding is 6 (to increase touch area) + y: 6 + height: parent.height - 12 radius: 2 color: control.Material.dialogColor -- cgit v1.2.3 From 31ed6f5235b841cce260d183eeb5c91d3eb8a93a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Oct 2016 17:37:43 +0200 Subject: Doc: minor tweaks to the Material style page Fix the value used in the foreground example, and mention the default accent value right after the brief description, before the example snippet, to make it more visible. The same order is used for all other properties. Change-Id: I10613b6ed2417eb886602d40e90cc74e2dbaf484 Reviewed-by: Mitch Curtis --- src/imports/controls/doc/src/qtquickcontrols2-material.qdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc index 3ff9f5ea..c253bf72 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc @@ -239,6 +239,8 @@ 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 Material.Pink. + In the following example, the accent color of the highlighted button is changed to \c Material.Orange: @@ -250,8 +252,6 @@ \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 recommended to use one of the \l {pre-defined Material colors} that have been designed to work well with the rest of the Material style palette. @@ -308,7 +308,7 @@ 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: + Material.Pink: \table \row -- cgit v1.2.3 From 2349b299a9d18d1884067a6ee0fad55d1e2f8d38 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Oct 2016 17:16:53 +0200 Subject: 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 --- .../images/qtquickcontrols2-universal-accent.png | Bin 0 -> 1079 bytes .../qtquickcontrols2-universal-background.png | Bin 0 -> 1326 bytes .../qtquickcontrols2-universal-foreground.png | Bin 0 -> 1027 bytes .../images/qtquickcontrols2-universal-theme.png | Bin 0 -> 1386 bytes .../snippets/qtquickcontrols2-universal-accent.qml | 43 ++++++++++++ .../qtquickcontrols2-universal-background.qml | 44 +++++++++++++ .../qtquickcontrols2-universal-foreground.qml | 41 ++++++++++++ .../snippets/qtquickcontrols2-universal-theme.qml | 44 +++++++++++++ .../doc/src/qtquickcontrols2-universal.qdoc | 73 +++++++++++++-------- 9 files changed, 219 insertions(+), 26 deletions(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-universal-background.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png new file mode 100644 index 00000000..be1a4a89 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png new file mode 100644 index 00000000..c91ab14d Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png new file mode 100644 index 00000000..e06b573b Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png new file mode 100644 index 00000000..f299b853 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png differ 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) } -- cgit v1.2.3 From 9977778a401d98f3f0ee10fdd92ae5342c45ddbf Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 22 Oct 2016 18:38:32 +0200 Subject: Fix tst_swipedelegate These tests did not pass on my Chromebook Pixel 2. The value of Qt.styleHints.startDragDistance is 19. Change-Id: I8843803608fc4c8ca2f2c42790d648eb17c141fd Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_swipedelegate.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 16cfea14..21bb1a37 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -304,7 +304,7 @@ TestCase { var control = swipeDelegateComponent.createObject(testCase); verify(control); - var overDragDistance = dragDistance * 1.1; + var overDragDistance = Math.round(dragDistance * 1.1); mouseSignalSequenceSpy.target = control; mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"]; @@ -433,7 +433,7 @@ TestCase { var control = swipeDelegateComponent.createObject(testCase); verify(control); - var distance = dragDistance * 1.1; + var distance = Math.round(dragDistance * 1.1); if (distance >= control.width / 2) skip("This test requires a startDragDistance that is less than half the width of the control"); @@ -826,7 +826,7 @@ TestCase { control.swipe.left = smallLeftComponent; // Ensure that the position is scaled to the width of the currently visible delegate. - var overDragDistance = dragDistance * 1.1; + var overDragDistance = Math.round(dragDistance * 1.1); mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton); mouseMove(control, control.width / 2 + overDragDistance, control.height / 2, Qt.LeftButton); verify(control.swipe.leftItem); @@ -885,7 +885,7 @@ TestCase { mousePress(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton); compare(leftVisibleSpy.count, 0); compare(rightVisibleSpy.count, 0); - var newX = control.swipe.leftItem.width - dragDistance * 1.1; + var newX = control.swipe.leftItem.width - Math.round(dragDistance * 1.1); mouseMove(control, newX, control.height / 2, Qt.LeftButton, Qt.LeftButton); compare(leftVisibleSpy.count, 0); compare(rightVisibleSpy.count, 0); -- cgit v1.2.3 From 848d2efcf4a89be82dc611d10d47bb970050c9b5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Oct 2016 21:49:39 +0200 Subject: Doc: supported environment variables Change-Id: I2ad1767c1066a07a86e0f5889b350aa4500d685e Reviewed-by: Mitch Curtis --- .../doc/src/includes/qquickmaterialstyle.qdocinc | 31 +++++++++++ .../doc/src/includes/qquickuniversalstyle.qdocinc | 26 +++++++++ .../doc/src/qtquickcontrols2-environment.qdoc | 65 ++++++++++++++++++++++ .../controls/doc/src/qtquickcontrols2-index.qdoc | 1 + .../doc/src/qtquickcontrols2-material.qdoc | 31 ++--------- .../controls/doc/src/qtquickcontrols2-styles.qdoc | 6 +- .../doc/src/qtquickcontrols2-universal.qdoc | 27 ++------- 7 files changed, 138 insertions(+), 49 deletions(-) create mode 100644 src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc create mode 100644 src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc create mode 100644 src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc diff --git a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc new file mode 100644 index 00000000..593e0588 --- /dev/null +++ b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc @@ -0,0 +1,31 @@ +//! [env] +\table + \header + \li Variable + \li Description + \row + \li \c QT_QUICK_CONTROLS_MATERIAL_THEME + \li Specifies the default \l {material-theme-attached-prop}{Material theme}. + The value can be one of the available themes, for example \c "Dark". + \row + \li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT + \li Specifies the default \l {material-accent-attached-prop}{Material accent color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Material colors}, for example \c "Teal". + \row + \li \c QT_QUICK_CONTROLS_MATERIAL_PRIMARY + \li Specifies the default \l {material-primary-attached-prop}{Material primary color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Material colors}, for example \c "BlueGrey". + \row + \li \c QT_QUICK_CONTROLS_MATERIAL_FOREGROUND + \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors}, + for example \c "Brown". + \row + \li \c QT_QUICK_CONTROLS_MATERIAL_BACKGROUND + \li Specifies the default \l {material-background-attached-prop}{Material background color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors}, + for example \c "Grey". +\endtable +//! [env] diff --git a/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc new file mode 100644 index 00000000..d3f4ad4f --- /dev/null +++ b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc @@ -0,0 +1,26 @@ +//! [env] +\table + \header + \li Variable + \li Description + \row + \li \c QT_QUICK_CONTROLS_UNIVERSAL_THEME + \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}. + The value can be one of the available themes, for example \c "Dark". + \row + \li \c QT_QUICK_CONTROLS_UNIVERSAL_ACCENT + \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Universal colors}, for example \c "Violet". + \row + \li \c QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND + \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors}, + for example \c "Brown". + \row + \li \c QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND + \li Specifies the default \l {universal-background-attached-prop}{Universal background color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors}, + for example \c "Steel". +\endtable +//! [env] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc new file mode 100644 index 00000000..9795471d --- /dev/null +++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \page qtquickcontrols2-environment.html + \title Supported Environment Variables in Qt Quick Controls 2 + + This page contains a list of all environment variables that Qt Quick Controls 2 + supports. The environment variables are primarily meant for testing purposes, but + they can also be used to set system-wide defaults. + + \table + \header + \li Variable + \li Description + \row + \li \c QT_QUICK_CONTROLS_STYLE + \li Specifies the default \l {Styling Qt Quick Controls 2}{Qt Quick Controls 2 style}. + The value can be either one of the built-in styles, for example \c "Material", + or the path to a custom style such as \c ":/mystyle". + \row + \li \c QT_QUICK_CONTROLS_CONF + \li Specifies the location of the Qt Quick Controls 2 configuration file. + By default, the configuration file is loaded from the application's + resources in \c ":/qtquickcontrols2.conf". + \endtable + + \l {Material style} specific environment variables: + + \include qquickmaterialstyle.qdocinc env + + \l {Universal style} specific environment variables: + + \include qquickuniversalstyle.qdocinc env + + \section1 Related Information + + \list + \li \l{Styling Qt Quick Controls 2} + \endlist +*/ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index de3d0c37..23f1e7e5 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -69,6 +69,7 @@ \li \l{Using File Selectors with Qt Quick Controls 2} \li \l{Differences between Qt Quick Controls} \li \l{Deploying Qt Quick Controls 2 Applications} + \li \l{Supported Environment Variables in Qt Quick Controls 2} \endlist \section1 Reference diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc index c253bf72..187b51ea 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -118,31 +118,10 @@ \section3 Environment Variables - \table - \header - \li Variable - \li Description - \row - \li \c QT_QUICK_CONTROLS_MATERIAL_THEME - \li The value can be one of the available \l {material-theme-attached-prop}{themes}, - for example \c "Dark". - \row - \li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT - \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended - to use one of the \l {pre-defined Material colors}, for example \c "Teal". - \row - \li \c QT_QUICK_CONTROLS_MATERIAL_PRIMARY - \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended - to use one of the \l {pre-defined Material colors}, for example \c "BlueGrey". - \row - \li \c QT_QUICK_CONTROLS_MATERIAL_FOREGROUND - \li The value can be any \l {colorbasictypedocs}{color}, or one of the - \l {pre-defined Material colors}. - \row - \li \c QT_QUICK_CONTROLS_MATERIAL_BACKGROUND - \li The value can be any \l {colorbasictypedocs}{color}, or one of the - \l {pre-defined Material colors}. - \endtable + \include qquickmaterialstyle.qdocinc env + + See \l {Supported Environment Variables in Qt Quick Controls 2} for the full + list of supported environment variables. \section2 Dependency diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index d63cbe69..2b44b50d 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -126,6 +126,9 @@ QT_QUICK_CONTROLS_STYLE=universal ./app \endcode + See \l {Supported Environment Variables in Qt Quick Controls 2} for the full list + of supported environment variables. + \section2 Configuration file \target qtquickcontrols2-conf @@ -183,5 +186,6 @@ \li \l {Universal Style} \li \l{Using File Selectors with Qt Quick Controls 2} \li \l {Deploying Qt Quick Controls 2 Applications} + \li \l {Supported Environment Variables in Qt Quick Controls 2} \endlist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc index b8f7789b..5ae99bef 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -117,27 +117,10 @@ \section3 Environment Variables - \table - \header - \li Variable - \li Description - \row - \li \c QT_QUICK_CONTROLS_UNIVERSAL_THEME - \li The value can be one of the available \l {universal-theme-attached-prop}{themes}, - for example \c "Dark". - \row - \li \c QT_QUICK_CONTROLS_UNIVERSAL_ACCENT - \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended - to use one of the \l {pre-defined Universal colors}, for example \c "Violet". - \row - \li \c QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND - \li The value can be any \l {colorbasictypedocs}{color}, or one of the - \l {pre-defined Universal colors}. - \row - \li \c QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND - \li The value can be any \l {colorbasictypedocs}{color}, or one of the - \l {pre-defined Universal colors}. - \endtable + \include qquickuniversalstyle.qdocinc env + + See \l {Supported Environment Variables in Qt Quick Controls 2} for the full + list of supported environment variables. \section2 Dependency -- cgit v1.2.3 From 26590b2c5cc70503bf691ad8b7290196fb1124af Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Oct 2016 22:41:59 +0200 Subject: Doc: configuration file Change-Id: I3de16850673488a8c67afc6b45a79d5bb86f9013 Reviewed-by: Mitch Curtis --- .../doc/src/includes/qquickmaterialstyle.qdocinc | 32 ++++++++ .../doc/src/includes/qquickuniversalstyle.qdocinc | 27 +++++++ .../doc/src/qtquickcontrols2-configuration.qdoc | 94 ++++++++++++++++++++++ .../doc/src/qtquickcontrols2-environment.qdoc | 3 +- .../controls/doc/src/qtquickcontrols2-index.qdoc | 1 + .../doc/src/qtquickcontrols2-material.qdoc | 12 ++- .../controls/doc/src/qtquickcontrols2-styles.qdoc | 40 +-------- .../doc/src/qtquickcontrols2-universal.qdoc | 12 ++- 8 files changed, 178 insertions(+), 43 deletions(-) create mode 100644 src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc diff --git a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc index 593e0588..c5d94279 100644 --- a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc @@ -1,3 +1,35 @@ +//! [conf] +\table + \header + \li Variable + \li Description + \row + \li \c Theme + \li Specifies the default \l {material-theme-attached-prop}{Material theme}. + The value can be one of the available themes, for example \c "Dark". + \row + \li \c Accent + \li Specifies the default \l {material-accent-attached-prop}{Material accent color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Material colors}, for example \c "Teal". + \row + \li \c Primary + \li Specifies the default \l {material-primary-attached-prop}{Material primary color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Material colors}, for example \c "BlueGrey". + \row + \li \c Foreground + \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors}, + for example \c "Brown". + \row + \li \c Background + \li Specifies the default \l {material-background-attached-prop}{Material background color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors}, + for example \c "Grey". +\endtable +//! [conf] + //! [env] \table \header diff --git a/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc index d3f4ad4f..a7ecbaef 100644 --- a/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc @@ -1,3 +1,30 @@ +//! [conf] +\table + \header + \li Variable + \li Description + \row + \li \c Theme + \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}. + The value can be one of the available themes, for example \c "Dark". + \row + \li \c Accent + \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}. + The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use + one of the \l {pre-defined Universal colors}, for example \c "Violet". + \row + \li \c Foreground + \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors}, + for example \c "Brown". + \row + \li \c Background + \li Specifies the default \l {universal-background-attached-prop}{Universal background color}. + The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors}, + for example \c "Steel". +\endtable +//! [conf] + //! [env] \table \header diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc new file mode 100644 index 00000000..29bfc99c --- /dev/null +++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \page qtquickcontrols2-configuration.html + \title Qt Quick Controls 2 Configuration File + + Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf, + that is built into an application's resources. + + The configuration file can specify the preferred style and certain style-specific + attributes. The following example specifies that the preferred style is the \l {Material style}. + Furthermore, when the application is run with the Material style, its theme is light and the + accent and primary colors are teal and blue grey, respectively. However, if the application + is run with the \l {Universal style} instead, the theme is dark and the accent color is red. + + \code + [Controls] + Style=Material + + [Universal] + Theme=Dark + Accent=Red + + [Material] + Theme=Light + Accent=Teal + Primary=BlueGrey + \endcode + + \l {Material style} specific values that can be specified in a \c Material + section of the configuration file: + + \include qquickmaterialstyle.qdocinc conf + + \l {Universal style} specific values that can be specified in a \c Universal + section of the configuration file: + + \include qquickuniversalstyle.qdocinc conf + + In order to make it possible for Qt Quick Controls 2 to find the configuration file, + it must be built into application's resources using the \l {The Qt Resource System}. + Here's an example \c .qrc file: + + \code + + + qtquickcontrols2.conf + + + \endcode + + \note Qt Quick Controls 2 uses a file selector to load the configuration file. It + is possible to provide a different configuration file for different platforms and + locales. See \l QFileSelector documentation for more details. + + Finally, the \c .qrc file must be listed in the application's \c .pro file so that + the build system knows about it. For example: + + \code + RESOURCES = application.qrc + \endcode + + \section1 Related Information + + \list + \li \l{Styling Qt Quick Controls 2} + \li \l{Supported Environment Variables in Qt Quick Controls 2} + \endlist +*/ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc index 9795471d..7c1b1c16 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc @@ -44,7 +44,7 @@ or the path to a custom style such as \c ":/mystyle". \row \li \c QT_QUICK_CONTROLS_CONF - \li Specifies the location of the Qt Quick Controls 2 configuration file. + \li Specifies the location of the \l {Qt Quick Controls 2 configuration file}. By default, the configuration file is loaded from the application's resources in \c ":/qtquickcontrols2.conf". \endtable @@ -61,5 +61,6 @@ \list \li \l{Styling Qt Quick Controls 2} + \li \l{Qt Quick Controls 2 Configuration File} \endlist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index 23f1e7e5..cdb20a27 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -69,6 +69,7 @@ \li \l{Using File Selectors with Qt Quick Controls 2} \li \l{Differences between Qt Quick Controls} \li \l{Deploying Qt Quick Controls 2 Applications} + \li \l{Qt Quick Controls 2 Configuration File} \li \l{Supported Environment Variables in Qt Quick Controls 2} \endlist diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc index 187b51ea..9842fee6 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc @@ -112,9 +112,15 @@ \endtable In addition to specifying the attributes in QML, it is also possible to - specify them via environment variables or in a \l {qtquickcontrols2-conf} - {configuration file}. Attributes specified in QML take precedence over all - other methods. + specify them via environment variables or in a configuration file. Attributes + specified in QML take precedence over all other methods. + + \section3 Configuration File + + \include qquickmaterialstyle.qdocinc conf + + See \l {Qt Quick Controls 2 Configuration File} for more details about the + configuration file. \section3 Environment Variables diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index 2b44b50d..dc0db600 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -130,54 +130,21 @@ of supported environment variables. \section2 Configuration file - \target qtquickcontrols2-conf Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf, that is built into an application's resources. The configuration file can specify the preferred style (may be overridden by either of the methods described earlier) and certain style-specific attributes. The following - example specifies that the preferred style is the Material style. Furthermore, when the - application is run with the Material style, its theme is light and the accent and primary - colors are teal and blue grey, respectively. However, if the application is run with the - Universal style instead, the theme is dark and the accent color is red. + example specifies that the preferred style is the Material style. \code [Controls] Style=Material - - [Universal] - Theme=Dark - Accent=Red - - [Material] - Theme=Light - Accent=Teal - Primary=BlueGrey - \endcode - - In order to make it possible for Qt Quick Controls 2 to find the configuration file, - it must be built into application's resources using the \l {The Qt Resource System}. - Here's an example \c .qrc file: - - \code - - - qtquickcontrols2.conf - - \endcode - \note Qt Quick Controls 2 uses a file selector to load the configuration file. It - is possible to provide a different configuration file for different platforms and - locales. See \l QFileSelector documentation for more details. - - Finally, the \c .qrc file must be listed in the application's \c .pro file so that - the build system knows about it. For example: - - \code - RESOURCES = application.qrc - \endcode + See \l {Qt Quick Controls 2 Configuration File} for more details about the + configuration file. \section1 Related Information \list @@ -186,6 +153,7 @@ \li \l {Universal Style} \li \l{Using File Selectors with Qt Quick Controls 2} \li \l {Deploying Qt Quick Controls 2 Applications} + \li \l {Qt Quick Controls 2 Configuration File} \li \l {Supported Environment Variables in Qt Quick Controls 2} \endlist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc index 5ae99bef..c0e2daee 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc @@ -111,9 +111,15 @@ \endtable In addition to specifying the attributes in QML, it is also possible to - specify them via environment variables or in a \l {qtquickcontrols2-conf} - {configuration file}. Attributes specified in QML take precedence over all - other methods. + specify them via environment variables or in a configuration file. Attributes + specified in QML take precedence over all other methods. + + \section3 Configuration File + + \include qquickuniversalstyle.qdocinc conf + + See \l {Qt Quick Controls 2 Configuration File} for more details about the + configuration file. \section3 Environment Variables -- cgit v1.2.3 From 86da7b7704f566bf6d669a7323839e486c77ec0d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Oct 2016 22:49:10 +0200 Subject: Doc: remove a redundant QQuickStyle example The "Styling Qt Quick Controls 2" -page is already overloaded with content. Give a minimal one-liner example and link to QQuickStyle for more details, which contains the same snippet that was removed. Change-Id: I77e196aeb8d407fcf05a264232dd83c2e28f97b7 Reviewed-by: Mitch Curtis --- .../controls/doc/src/qtquickcontrols2-styles.qdoc | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index dc0db600..d9c03ec3 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -83,28 +83,15 @@ \section2 Using QQuickStyle in C++ - \l QQuickStyle provides API for configuring a specific style. The following + \l QQuickStyle provides C++ API for configuring a specific style. The following example runs a Qt Quick Controls 2 application with the Material style: \code - #include - #include - #include - - int main(int argc, char *argv[]) - { - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - - QQuickStyle::setStyle("Material"); - - QQmlApplicationEngine engine; - engine.load(QUrl("qrc:/main.qml")); - - return app.exec(); - } + QQuickStyle::setStyle("Material"); \endcode + See the detailed description of \l QQuickStyle for more details. + \section2 Command line argument Passing a \c -style command line argument is the convenient way to test different -- cgit v1.2.3 From 1acc393933650f824de427f6b0ca3e38a0a8bdb4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 25 Oct 2016 09:45:41 +0200 Subject: Doc: fix typo in QQuickStyle brief Change-Id: I629871ac8a077fda900f69d788d612bc3688728f Reviewed-by: J-P Nurmi --- src/quickcontrols2/qquickstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp index f432eded..471fcec2 100644 --- a/src/quickcontrols2/qquickstyle.cpp +++ b/src/quickcontrols2/qquickstyle.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QQuickStyle - \brief The QQQuickStyle class allows configuring the application style. + \brief The QQuickStyle class allows configuring the application style. \inmodule QtQuickControls2 \since 5.7 -- cgit v1.2.3