aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-06 23:27:32 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-06 23:31:16 +0200
commit9a9a9bd1144663e2cb74efdd3d3f6d76c72313f9 (patch)
tree2811ccf99d641b040587716f17be8c59a30e11fe /src/imports
parent320647bce7d968b5798dfc6946df555a548e3f8f (diff)
parent86180aed5008779b1b94731d9b4c6b1fdac8f3d3 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/Container.qml47
-rw-r--r--src/imports/controls/Control.qml47
-rw-r--r--src/imports/controls/RoundButton.qml77
-rw-r--r--src/imports/controls/TextField.qml6
-rw-r--r--src/imports/controls/controls.pri3
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-roundbutton.pngbin0 -> 1001 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml36
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc6
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc11
-rw-r--r--src/imports/controls/material/RoundButton.qml115
-rw-r--r--src/imports/controls/material/TextField.qml8
-rw-r--r--src/imports/controls/material/ToolBar.qml2
-rw-r--r--src/imports/controls/material/material.pri1
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp23
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h4
-rw-r--r--src/imports/controls/plugins.qmltypes81
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp5
-rw-r--r--src/imports/controls/universal/RoundButton.qml87
-rw-r--r--src/imports/controls/universal/TextField.qml6
-rw-r--r--src/imports/controls/universal/universal.pri1
-rw-r--r--src/imports/templates/plugins.qmltypes17
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
22 files changed, 549 insertions, 36 deletions
diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml
new file mode 100644
index 00000000..9e9215f8
--- /dev/null
+++ b/src/imports/controls/Container.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.Container {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+}
diff --git a/src/imports/controls/Control.qml b/src/imports/controls/Control.qml
new file mode 100644
index 00000000..a4bb95fe
--- /dev/null
+++ b/src/imports/controls/Control.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.Control {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+}
diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml
new file mode 100644
index 00000000..102774e0
--- /dev/null
+++ b/src/imports/controls/RoundButton.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.1 as T
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ padding: 6
+
+ //! [contentItem]
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled || control.highlighted || control.checked ? 1 : 0.3
+ color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637"))
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 40
+ implicitHeight: 40
+ radius: control.radius
+ opacity: enabled ? 1 : 0.3
+ visible: !control.flat || control.down || control.checked || control.highlighted
+ color: control.checked || control.highlighted ?
+ (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) :
+ (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0"))
+ border.color: "#0066ff"
+ border.width: control.visualFocus ? 2 : 0
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml
index 5fdb6fc9..540a8da4 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -41,8 +41,10 @@ T.TextField {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 9eeb2c1f..f84c59bc 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -16,6 +16,8 @@ QML_CONTROLS = \
CheckDelegate.qml \
CheckIndicator.qml \
ComboBox.qml \
+ Container.qml \
+ Control.qml \
Dial.qml \
Dialog.qml \
DialogButtonBox.qml \
@@ -36,6 +38,7 @@ QML_CONTROLS = \
RadioDelegate.qml \
RadioIndicator.qml \
RangeSlider.qml \
+ RoundButton.qml \
ScrollBar.qml \
ScrollIndicator.qml \
Slider.qml \
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png
new file mode 100644
index 00000000..9f1d44fc
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml
new file mode 100644
index 00000000..fa926302
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** 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.1
+
+//! [1]
+RoundButton {
+ text: "\u2713" // Unicode Character 'CHECK MARK'
+ onClicked: textArea.readOnly = true
+}
+//! [1]
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index d98b70d1..3e804bd4 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -548,6 +548,12 @@
\snippet qtquickcontrols2-rangeslider-custom.qml file
+ \section2 Customizing RoundButton
+
+ RoundButton can be customized in the same manner as
+ \l {Customizing Button}{Button}.
+
+
\section2 Customizing ScrollBar
ScrollBar consists of two visual items: \l {Control::background}{background}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
index 74a7ece1..5685a852 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -39,6 +39,7 @@
\list
\li \l {material-accent-attached-prop}{\b accent} : color
\li \l {material-background-attached-prop}{\b background} : color
+ \li \l {material-elevation-attached-prop}{\b elevation} : int
\li \l {material-foreground-attached-prop}{\b foreground} : color
\li \l {material-primary-attached-prop}{\b primary} : color
\li \l {material-theme-attached-prop}{\b theme} : enumeration
@@ -280,6 +281,16 @@
\endstyleproperty
+ \styleproperty {Material.elevation} {int} {material-elevation-attached-prop}
+ \target material-elevation-attached-prop
+ This attached property holds the elevation of the control. The higher the
+ elevation, the deeper the shadow. The property can be attached to any control,
+ but not all controls visualize elevation.
+
+ The default value is control-specific.
+
+ \endstyleproperty
+
\styleproperty {Material.foreground} {color} {material-foreground-attached-prop}
\target material-foreground-attached-prop
This attached property holds the foreground color of the theme. The property
diff --git a/src/imports/controls/material/RoundButton.qml b/src/imports/controls/material/RoundButton.qml
new file mode 100644
index 00000000..57f30e30
--- /dev/null
+++ b/src/imports/controls/material/RoundButton.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ // external vertical padding is 6 (to increase touch area)
+ padding: 12
+
+ hoverEnabled: Qt.styleHints.useHoverEffects
+
+ Material.elevation: flat ? control.down || control.hovered ? 2 : 0
+ : control.down ? 8 : 2
+ Material.background: flat ? "transparent" : undefined
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ color: !control.enabled ? control.Material.hintTextColor :
+ control.flat && control.highlighted ? control.Material.accentColor :
+ control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
+ background: Rectangle {
+ implicitWidth: 48
+ implicitHeight: 48
+
+ // external vertical padding is 6 (to increase touch area)
+ x: 6
+ y: 6
+ width: parent.width - 12
+ height: parent.height - 12
+ radius: control.radius
+ color: !control.enabled ? control.Material.buttonDisabledColor
+ : control.checked || control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ visible: control.hovered || control.visualFocus
+ color: control.Material.rippleColor
+ }
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ visible: control.down
+ color: control.Material.rippleColor
+ }
+
+ Behavior on color {
+ ColorAnimation {
+ duration: 400
+ }
+ }
+
+ // The layer is disabled when the button color is transparent so that you can do
+ // Material.background: "transparent" and get a proper flat button without needing
+ // to set Material.elevation as well
+ layer.enabled: control.enabled && control.Material.buttonColor.a > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ }
+ }
+}
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml
index a6406afa..25811322 100644
--- a/src/imports/controls/material/TextField.qml
+++ b/src/imports/controls/material/TextField.qml
@@ -42,9 +42,11 @@ T.TextField {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- placeholder.implicitHeight + 1 + topPadding + bottomPadding)
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
+ placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: 8
bottomPadding: 16
diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml
index ce4f64ec..0da814f1 100644
--- a/src/imports/controls/material/ToolBar.qml
+++ b/src/imports/controls/material/ToolBar.qml
@@ -56,7 +56,7 @@ T.ToolBar {
background: Rectangle {
implicitHeight: 48
- color: control.Material.primaryColor
+ color: control.Material.toolBarColor
layer.enabled: control.Material.elevation > 0
layer.effect: ElevationEffect {
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index 437edeee..3170a695 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -42,6 +42,7 @@ QML_FILES += \
$$PWD/RadioDelegate.qml \
$$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
+ $$PWD/RoundButton.qml \
$$PWD/RectangularGlow.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 76332c51..0e9f31df 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -706,6 +706,7 @@ void QQuickMaterialStyle::setBackground(const QVariant &var)
m_background = background;
propagateBackground();
emit backgroundChanged();
+ emit paletteChanged();
}
void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool has)
@@ -854,7 +855,7 @@ QColor QQuickMaterialStyle::buttonColor(bool highlighted) const
QColor color = Qt::transparent;
- if (m_hasBackground) {
+ if (m_explicitBackground) {
color = backgroundColor(shade);
} else if (highlighted) {
color = accentColor(shade);
@@ -950,16 +951,11 @@ QColor QQuickMaterialStyle::scrollBarPressedColor() const
return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF);
}
-QColor QQuickMaterialStyle::drawerBackgroundColor() const
-{
- return QColor::fromRgba(dividerColorLight);
-}
-
QColor QQuickMaterialStyle::dialogColor() const
{
- if (!m_hasBackground)
- return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark);
- return backgroundColor();
+ if (m_hasBackground)
+ return backgroundColor();
+ return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark);
}
QColor QQuickMaterialStyle::backgroundDimColor() const
@@ -974,9 +970,18 @@ QColor QQuickMaterialStyle::listHighlightColor() const
QColor QQuickMaterialStyle::tooltipColor() const
{
+ if (m_explicitBackground)
+ return backgroundColor();
return color(Grey, Shade700);
}
+QColor QQuickMaterialStyle::toolBarColor() const
+{
+ if (m_explicitBackground)
+ return backgroundColor();
+ return primaryColor();
+}
+
QColor QQuickMaterialStyle::toolTextColor() const
{
if (m_hasForeground || m_customPrimary)
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 78ba88da..e6e4fe05 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -91,11 +91,11 @@ class QQuickMaterialStyle : public QQuickStyleAttached
Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarHoveredColor READ scrollBarHoveredColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor drawerBackgroundColor READ drawerBackgroundColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor tooltipColor READ tooltipColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor toolBarColor READ toolBarColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL)
@@ -213,11 +213,11 @@ public:
QColor scrollBarColor() const;
QColor scrollBarHoveredColor() const;
QColor scrollBarPressedColor() const;
- QColor drawerBackgroundColor() const;
QColor dialogColor() const;
QColor backgroundDimColor() const;
QColor listHighlightColor() const;
QColor tooltipColor() const;
+ QColor toolBarColor() const;
QColor toolTextColor() const;
QColor spinBoxDisabledIconColor() const;
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index 0700e7bf..a1ca509b 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -16,14 +16,14 @@ Module {
name: "QQuickBusyIndicatorRing"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtQuick.Controls.impl/BusyRing 2.1"]
+ exports: ["QtQuick.Controls.impl/BusyRing 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickDialRing"
defaultProperty: "data"
prototype: "QQuickPaintedItem"
- exports: ["QtQuick.Controls.impl/DialRing 2.1"]
+ exports: ["QtQuick.Controls.impl/DialRing 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "progress"; type: "double" }
Property { name: "color"; type: "QColor" }
@@ -32,7 +32,7 @@ Module {
name: "QQuickProgressStrip"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtQuick.Controls.impl/ProgressStrip 2.1"]
+ exports: ["QtQuick.Controls.impl/ProgressStrip 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "indeterminate"; type: "bool" }
Property { name: "progress"; type: "double" }
@@ -89,9 +89,9 @@ Module {
}
Component {
prototype: "QQuickRectangle"
- name: "QtQuick.Controls.impl/CheckIndicator 2.1"
- exports: ["QtQuick.Controls.impl/CheckIndicator 2.1"]
- exportMetaObjectRevisions: [1]
+ name: "QtQuick.Controls.impl/CheckIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/CheckIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "control"; type: "QQuickItem"; isPointer: true }
@@ -105,6 +105,22 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickContainer"
+ name: "QtQuick.Controls/Container 2.0"
+ exports: ["QtQuick.Controls/Container 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickControl"
+ name: "QtQuick.Controls/Control 2.0"
+ exports: ["QtQuick.Controls/Control 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickDial"
name: "QtQuick.Controls/Dial 2.0"
exports: ["QtQuick.Controls/Dial 2.0"]
@@ -185,6 +201,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickMenuSeparator"
+ name: "QtQuick.Controls/MenuSeparator 2.1"
+ exports: ["QtQuick.Controls/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickPage"
name: "QtQuick.Controls/Page 2.0"
exports: ["QtQuick.Controls/Page 2.0"]
@@ -242,9 +266,9 @@ Module {
}
Component {
prototype: "QQuickRectangle"
- name: "QtQuick.Controls.impl/RadioIndicator 2.1"
- exports: ["QtQuick.Controls.impl/RadioIndicator 2.1"]
- exportMetaObjectRevisions: [1]
+ name: "QtQuick.Controls.impl/RadioIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/RadioIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "control"; type: "QQuickItem"; isPointer: true }
@@ -258,6 +282,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickRoundButton"
+ name: "QtQuick.Controls/RoundButton 2.1"
+ exports: ["QtQuick.Controls/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickScrollBar"
name: "QtQuick.Controls/ScrollBar 2.0"
exports: ["QtQuick.Controls/ScrollBar 2.0"]
@@ -331,9 +363,9 @@ Module {
}
Component {
prototype: "QQuickItem"
- name: "QtQuick.Controls.impl/SwitchIndicator 2.1"
- exports: ["QtQuick.Controls.impl/SwitchIndicator 2.1"]
- exportMetaObjectRevisions: [1]
+ name: "QtQuick.Controls.impl/SwitchIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/SwitchIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "control"; type: "QQuickItem"; isPointer: true }
@@ -529,11 +561,15 @@ Module {
name: "QQuickComboBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/ComboBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/ComboBox 2.0",
+ "QtQuick.Templates/ComboBox 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
+ Property { name: "flat"; revision: 1; type: "bool" }
Property { name: "pressed"; type: "bool" }
Property { name: "highlightedIndex"; type: "int"; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
@@ -543,6 +579,7 @@ Module {
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal { name: "flatChanged"; revision: 1 }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -982,6 +1019,13 @@ Module {
Signal { name: "triggered" }
}
Component {
+ name: "QQuickMenuSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
@@ -1202,6 +1246,14 @@ Module {
}
}
Component {
+ name: "QQuickRoundButton"
+ defaultProperty: "data"
+ prototype: "QQuickButton"
+ exports: ["QtQuick.Templates/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
name: "QQuickScrollBar"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -1333,6 +1385,7 @@ Module {
Signal { name: "activating" }
Signal { name: "deactivated" }
Signal { name: "deactivating" }
+ Signal { name: "removed" }
}
Component {
name: "QQuickStackView"
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 3cd3b8b2..f7ee00a6 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -87,8 +87,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickAbstractButton>(uri, 2, 0, "AbstractButton");
qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
qmlRegisterType<QQuickButtonGroupAttached>();
- qmlRegisterType<QQuickContainer>(uri, 2, 0, "Container");
- qmlRegisterType<QQuickControl>(uri, 2, 0, "Control");
QQuickStylePrivate::init(typeUrl());
const QString style = QQuickStyle::name();
@@ -104,6 +102,8 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterType(selector.select(QStringLiteral("CheckBox.qml")), uri, 2, 0, "CheckBox");
qmlRegisterType(selector.select(QStringLiteral("CheckDelegate.qml")), uri, 2, 0, "CheckDelegate");
qmlRegisterType(selector.select(QStringLiteral("ComboBox.qml")), uri, 2, 0, "ComboBox");
+ qmlRegisterType(selector.select(QStringLiteral("Container.qml")), uri, 2, 0, "Container");
+ qmlRegisterType(selector.select(QStringLiteral("Control.qml")), uri, 2, 0, "Control");
qmlRegisterType(selector.select(QStringLiteral("Dial.qml")), uri, 2, 0, "Dial");
qmlRegisterType(selector.select(QStringLiteral("Drawer.qml")), uri, 2, 0, "Drawer");
qmlRegisterType(selector.select(QStringLiteral("Frame.qml")), uri, 2, 0, "Frame");
@@ -144,6 +144,7 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterType(selector.select(QStringLiteral("Dialog.qml")), uri, 2, 1, "Dialog");
qmlRegisterType(selector.select(QStringLiteral("DialogButtonBox.qml")), uri, 2, 1, "DialogButtonBox");
qmlRegisterType(selector.select(QStringLiteral("MenuSeparator.qml")), uri, 2, 1, "MenuSeparator");
+ qmlRegisterType(selector.select(QStringLiteral("RoundButton.qml")), uri, 2, 1, "RoundButton");
qmlRegisterType(selector.select(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator");
}
diff --git a/src/imports/controls/universal/RoundButton.qml b/src/imports/controls/universal/RoundButton.qml
new file mode 100644
index 00000000..61701099
--- /dev/null
+++ b/src/imports/controls/universal/RoundButton.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ hoverEnabled: Qt.styleHints.useHoverEffects
+
+ padding: 8
+
+ property bool useSystemFocusVisuals: true
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ implicitWidth: 32
+ implicitHeight: 32
+
+ radius: control.radius
+ visible: !control.flat || control.down || control.checked || control.highlighted
+ color: control.down ? control.Universal.baseMediumLowColor :
+ control.enabled && (control.highlighted || control.checked) ? control.Universal.accent :
+ control.Universal.baseLowColor
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ color: "transparent"
+ visible: control.hovered
+ border.width: 2 // ButtonBorderThemeThickness
+ border.color: control.Universal.baseMediumLowColor
+ }
+ }
+}
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index 88bc4fc9..afa09946 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -41,9 +41,9 @@ import QtQuick.Controls.Universal 2.1
T.TextField {
id: control
- implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
background ? background.implicitHeight : 0,
placeholder.implicitHeight + topPadding + bottomPadding)
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index 72edbc32..3697a2a6 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -26,6 +26,7 @@ QML_FILES += \
$$PWD/RadioDelegate.qml \
$$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
+ $$PWD/RoundButton.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index cbcc1fc7..dd991cfe 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -144,6 +144,7 @@ Module {
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal { name: "flatChanged"; revision: 1 }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -583,6 +584,13 @@ Module {
Signal { name: "triggered" }
}
Component {
+ name: "QQuickMenuSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
@@ -803,6 +811,14 @@ Module {
}
}
Component {
+ name: "QQuickRoundButton"
+ defaultProperty: "data"
+ prototype: "QQuickButton"
+ exports: ["QtQuick.Templates/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
name: "QQuickScrollBar"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -934,6 +950,7 @@ Module {
Signal { name: "activating" }
Signal { name: "deactivated" }
Signal { name: "deactivating" }
+ Signal { name: "removed" }
}
Component {
name: "QQuickStackView"
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 67a52d14..6624b019 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -66,6 +66,7 @@
#include <QtQuickTemplates2/private/qquickradiobutton_p.h>
#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
#include <QtQuickTemplates2/private/qquickrangeslider_p.h>
+#include <QtQuickTemplates2/private/qquickroundbutton_p.h>
#include <QtQuickTemplates2/private/qquickscrollbar_p.h>
#include <QtQuickTemplates2/private/qquickscrollindicator_p.h>
#include <QtQuickTemplates2/private/qquickslider_p.h>
@@ -186,6 +187,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickMenuSeparator>(uri, 2, 1, "MenuSeparator");
qmlRegisterType<QQuickPopup, 1>(uri, 2, 1, "Popup");
qmlRegisterType<QQuickRangeSlider, 1>(uri, 2, 1, "RangeSlider");
+ qmlRegisterType<QQuickRoundButton, 1>(uri, 2, 1, "RoundButton");
qmlRegisterType<QQuickSlider, 1>(uri, 2, 1, "Slider");
qmlRegisterType<QQuickSpinBox, 1>(uri, 2, 1, "SpinBox");
qmlRegisterType<QQuickStackView, 1>(uri, 2, 1, "StackView");