diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-14 01:00:27 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-04-14 15:09:05 +0000 |
commit | 28ab81f2c02378735ff82a6e130f0d38d6471069 (patch) | |
tree | ce6df68f10c222929054f8f8916c669ab7e362cc | |
parent | 704625a034270739e886a28bfa6e8889c8ad984b (diff) | |
parent | 625a7d1a5cb0b808a734ee7ea1e268c409417349 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
-rw-r--r-- | src/imports/controls/fusion/plugins.qmltypes | 146 | ||||
-rw-r--r-- | src/imports/controls/material/CheckIndicator.qml | 5 | ||||
-rw-r--r-- | src/imports/controls/material/RadioIndicator.qml | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquicklabel.cpp | 31 | ||||
-rw-r--r-- | src/quicktemplates2/qquicklabel_p_p.h | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextarea.cpp | 1 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextfield.cpp | 1 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_label.qml | 24 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_popup.qml | 8 |
9 files changed, 207 insertions, 14 deletions
diff --git a/src/imports/controls/fusion/plugins.qmltypes b/src/imports/controls/fusion/plugins.qmltypes new file mode 100644 index 00000000..e6c350d6 --- /dev/null +++ b/src/imports/controls/fusion/plugins.qmltypes @@ -0,0 +1,146 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable QtQuick.Controls.Fusion 2.3' + +Module { + dependencies: [ ] + Component { + name: "QQuickFusionBusyIndicator" + defaultProperty: "data" + prototype: "QQuickPaintedItem" + exports: ["QtQuick.Controls.Fusion.impl/BusyIndicatorImpl 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "color"; type: "QColor" } + Property { name: "running"; type: "bool" } + } + Component { + name: "QQuickFusionDial" + defaultProperty: "data" + prototype: "QQuickPaintedItem" + exports: ["QtQuick.Controls.Fusion.impl/DialImpl 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "highlight"; type: "bool" } + Property { name: "palette"; type: "QPalette" } + } + Component { + name: "QQuickFusionKnob" + defaultProperty: "data" + prototype: "QQuickPaintedItem" + exports: ["QtQuick.Controls.Fusion.impl/KnobImpl 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "palette"; type: "QPalette" } + } + Component { + name: "QQuickFusionStyle" + prototype: "QObject" + exports: ["QtQuick.Controls.Fusion.impl/Fusion 2.3"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + Property { name: "lightShade"; type: "QColor"; isReadonly: true } + Property { name: "darkShade"; type: "QColor"; isReadonly: true } + Property { name: "topShadow"; type: "QColor"; isReadonly: true } + Property { name: "innerContrastLine"; type: "QColor"; isReadonly: true } + Method { + name: "highlight" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "highlightedText" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "outline" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "highlightedOutline" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "tabFrameColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "buttonColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + Parameter { name: "highlighted"; type: "bool" } + Parameter { name: "down"; type: "bool" } + Parameter { name: "hovered"; type: "bool" } + } + Method { + name: "buttonColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + Parameter { name: "highlighted"; type: "bool" } + Parameter { name: "down"; type: "bool" } + } + Method { + name: "buttonColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + Parameter { name: "highlighted"; type: "bool" } + } + Method { + name: "buttonColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "buttonOutline" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + Parameter { name: "highlighted"; type: "bool" } + Parameter { name: "enabled"; type: "bool" } + } + Method { + name: "buttonOutline" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + Parameter { name: "highlighted"; type: "bool" } + } + Method { + name: "buttonOutline" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + Method { + name: "gradientStart" + type: "QColor" + Parameter { name: "baseColor"; type: "QColor" } + } + Method { + name: "gradientStop" + type: "QColor" + Parameter { name: "baseColor"; type: "QColor" } + } + Method { + name: "mergedColors" + type: "QColor" + Parameter { name: "colorA"; type: "QColor" } + Parameter { name: "colorB"; type: "QColor" } + Parameter { name: "factor"; type: "int" } + } + Method { + name: "mergedColors" + type: "QColor" + Parameter { name: "colorA"; type: "QColor" } + Parameter { name: "colorB"; type: "QColor" } + } + Method { + name: "grooveColor" + type: "QColor" + Parameter { name: "palette"; type: "QPalette" } + } + } +} diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml index bfeda537..c52d5ae0 100644 --- a/src/imports/controls/material/CheckIndicator.qml +++ b/src/imports/controls/material/CheckIndicator.qml @@ -43,8 +43,9 @@ Rectangle { implicitWidth: 18 implicitHeight: 18 color: "transparent" - border.color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor - border.width: control.checked ? width / 2 : 2 + border.color: !control.enabled ? control.Material.hintTextColor + : control.checkState !== Qt.Unchecked ? control.Material.accentColor : control.Material.secondaryTextColor + border.width: control.checkState !== Qt.Unchecked ? width / 2 : 2 radius: 2 property Item control diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml index 0ed632a6..f69f31cc 100644 --- a/src/imports/controls/material/RadioIndicator.qml +++ b/src/imports/controls/material/RadioIndicator.qml @@ -43,7 +43,8 @@ Rectangle { implicitHeight: 20 radius: width / 2 border.width: 2 - border.color: control.checked || control.down ? control.Material.accentColor : control.Material.secondaryTextColor + border.color: !control.enabled ? control.Material.hintTextColor + : control.checked || control.down ? control.Material.accentColor : control.Material.secondaryTextColor color: "transparent" property Item control diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp index ad90a727..e54aa556 100644 --- a/src/quicktemplates2/qquicklabel.cpp +++ b/src/quicktemplates2/qquicklabel.cpp @@ -94,6 +94,22 @@ QQuickLabelPrivate::~QQuickLabelPrivate() #endif } +void QQuickLabelPrivate::resizeBackground() +{ + Q_Q(QQuickLabel); + if (background) { + QQuickItemPrivate *p = QQuickItemPrivate::get(background); + if (!p->widthValid) { + background->setWidth(q->width()); + p->widthValid = false; + } + if (!p->heightValid) { + background->setHeight(q->height()); + p->heightValid = false; + } + } +} + /*! \internal @@ -279,6 +295,8 @@ void QQuickLabel::setBackground(QQuickItem *background) background->setParentItem(this); if (qFuzzyIsNull(background->z())) background->setZ(-1); + if (isComponentComplete()) + d->resizeBackground(); } if (!d->background.isExecuting()) emit backgroundChanged(); @@ -329,6 +347,7 @@ void QQuickLabel::componentComplete() Q_D(QQuickLabel); d->executeBackground(true); QQuickText::componentComplete(); + d->resizeBackground(); #if QT_CONFIG(accessibility) if (QAccessible::isActive()) d->accessibilityActiveChanged(true); @@ -359,17 +378,7 @@ void QQuickLabel::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe { Q_D(QQuickLabel); QQuickText::geometryChanged(newGeometry, oldGeometry); - if (d->background) { - QQuickItemPrivate *p = QQuickItemPrivate::get(d->background); - if (!p->widthValid) { - d->background->setWidth(newGeometry.width()); - p->widthValid = false; - } - if (!p->heightValid) { - d->background->setHeight(newGeometry.height()); - p->heightValid = false; - } - } + d->resizeBackground(); } QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h index bcd1aca6..4d6c7de7 100644 --- a/src/quicktemplates2/qquicklabel_p_p.h +++ b/src/quicktemplates2/qquicklabel_p_p.h @@ -74,6 +74,8 @@ public: return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(item)); } + void resizeBackground(); + void resolveFont(); void inheritFont(const QFont &font); void updateFont(const QFont &font); diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 45a084d2..4193483c 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -742,6 +742,7 @@ void QQuickTextArea::componentComplete() Q_D(QQuickTextArea); d->executeBackground(true); QQuickTextEdit::componentComplete(); + d->resizeBackground(); #if QT_CONFIG(quicktemplates2_hover) if (!d->explicitHoverEnabled) setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem)); diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index 65ffb7d9..3125028f 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -593,6 +593,7 @@ void QQuickTextField::componentComplete() Q_D(QQuickTextField); d->executeBackground(true); QQuickTextInput::componentComplete(); + d->resizeBackground(); #if QT_CONFIG(quicktemplates2_hover) if (!d->explicitHoverEnabled) setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem)); diff --git a/tests/auto/controls/data/tst_label.qml b/tests/auto/controls/data/tst_label.qml index 5618fe07..69d273a7 100644 --- a/tests/auto/controls/data/tst_label.qml +++ b/tests/auto/controls/data/tst_label.qml @@ -66,6 +66,18 @@ TestCase { } Component { + id: backgroundLabel + Label { + background: Rectangle { } + } + } + + Component { + id: rectangle + Rectangle { } + } + + Component { id: signalSpy SignalSpy { } } @@ -115,4 +127,16 @@ TestCase { compare(child.font[data.tag], defaultValue) compare(childSpy.count, 0) } + + function test_background() { + var control = createTemporaryObject(backgroundLabel, testCase, {text: "Label"}) + verify(control) + + compare(control.background.width, control.width) + compare(control.background.height, control.height) + + control.background = rectangle.createObject(control) + compare(control.background.width, control.width) + compare(control.background.height, control.height) + } } diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml index dbea7496..9ff01e40 100644 --- a/tests/auto/controls/data/tst_popup.qml +++ b/tests/auto/controls/data/tst_popup.qml @@ -1351,11 +1351,13 @@ TestCase { visible: true property alias popup: popup + property alias shortcut: shortcut Popup { id: popup Shortcut { + id: shortcut sequence: "Tab" onActivated: popup.visible = !popup.visible } @@ -1369,11 +1371,17 @@ TestCase { var window = createTemporaryObject(shortcutWindowComponent, testCase) var control = window.popup + var shortcutActivatedSpy = createTemporaryObject(signalSpy, testCase, + { target: window.shortcut, signalName: "activated"} ) + verify(shortcutActivatedSpy.valid) + waitForRendering(window.contentItem) keyClick(Qt.Key_Tab) + compare(shortcutActivatedSpy.count, 1) tryCompare(control, "visible", true) keyClick(Qt.Key_Tab) + compare(shortcutActivatedSpy.count, 2) tryCompare(control, "visible", false) } } |