From ef45aff14c61983b3659094e0cf5d9db706d9cbd Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Sep 2016 17:26:57 +0200 Subject: Doc: mention Material.elevation in the docs Change-Id: I514a784df656d2690c8c2cb285cec8d48102b3be Reviewed-by: Mitch Curtis --- src/imports/controls/doc/src/qtquickcontrols2-material.qdoc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/imports') diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc index 9416a505..a5ac25d2 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 -- cgit v1.2.3 From c7b8289a706f982c1cf5091a4d86606ec758b05d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Sep 2016 19:43:20 +0200 Subject: TextField: improve the implicit size calculation In general, we don't want TextField to grow while typing, but if there is no background nor placeholder, use content width as a fallback. Also take content height into account while calculating the implicit height. Task-number: QTBUG-55684 Change-Id: Iee0eff6861c3573045036a06d7e53f7fc313fbe8 Reviewed-by: Mitch Curtis --- src/imports/controls/TextField.qml | 6 ++++-- src/imports/controls/material/TextField.qml | 8 +++++--- src/imports/controls/universal/TextField.qml | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/imports') diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index 2234646f..35703940 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/material/TextField.qml b/src/imports/controls/material/TextField.qml index 9c576ca6..580b43bd 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/universal/TextField.qml b/src/imports/controls/universal/TextField.qml index a245ba39..bd496ecc 100644 --- a/src/imports/controls/universal/TextField.qml +++ b/src/imports/controls/universal/TextField.qml @@ -41,9 +41,9 @@ import QtQuick.Controls.Universal 2.0 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) -- cgit v1.2.3 From 7e109cdd105d3d152d4a5c9dba16926e78602a04 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Sep 2016 21:42:55 +0200 Subject: Material: fix popups to respect Material.background Task-number: QTBUG-55687 Change-Id: I217ad905cc06228a6a1608c0721dc20a31db6d9b Reviewed-by: Mitch Curtis --- src/imports/controls/material/qquickmaterialstyle.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/imports') diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 8562cdbb..3676bdbb 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -1020,6 +1020,8 @@ QColor QQuickMaterialStyle::scrollBarPressedColor() const QColor QQuickMaterialStyle::dialogColor() const { + if (m_hasBackground) + return backgroundColor(); return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark); } @@ -1035,6 +1037,8 @@ QColor QQuickMaterialStyle::listHighlightColor() const QColor QQuickMaterialStyle::tooltipColor() const { + if (m_explicitBackground) + return backgroundColor(); return color(Grey, Shade700); } -- cgit v1.2.3 From 058f2dcc6070a9a36f269dd3fff6017c546d0b53 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Sep 2016 01:15:33 +0200 Subject: Material: fix ToolBar to respect Material.background Task-number: QTBUG-55687 Change-Id: I815291847bad72ae58b66dc70b510ce11cd88b8d Reviewed-by: Mitch Curtis --- src/imports/controls/material/ToolBar.qml | 2 +- src/imports/controls/material/qquickmaterialstyle.cpp | 7 +++++++ src/imports/controls/material/qquickmaterialstyle_p.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/imports') diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml index 1bcffd82..f0b50f73 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/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 3676bdbb..ae8c3a11 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -1042,6 +1042,13 @@ QColor QQuickMaterialStyle::tooltipColor() const 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 ff8fcce5..e0ac29cf 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -102,6 +102,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached 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) @@ -229,6 +230,7 @@ public: QColor backgroundDimColor() const; QColor listHighlightColor() const; QColor tooltipColor() const; + QColor toolBarColor() const; QColor toolTextColor() const; QColor spinBoxDisabledIconColor() const; -- cgit v1.2.3