diff options
20 files changed, 349 insertions, 59 deletions
diff --git a/.qmake.conf b/.qmake.conf index 0d16d9ba..dd4088c7 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH QQC2_SOURCE_TREE = $$PWD -MODULE_VERSION = 5.12.1 +MODULE_VERSION = 5.12.2 diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 6b7fe008..69156114 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -55,6 +55,7 @@ T.ComboBox { delegate: ItemDelegate { width: parent.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData + palette.text: control.highlightedIndex === index ? control.palette.highlightedText : control.palette.text font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index hoverEnabled: control.hoverEnabled @@ -132,6 +133,8 @@ T.ComboBox { T.ScrollIndicator.vertical: ScrollIndicator { } } - background: Rectangle { } + background: Rectangle { + color: control.palette.window + } } } diff --git a/src/imports/controls/designer/DialSpecifics.qml b/src/imports/controls/designer/DialSpecifics.qml index c338fa94..fc5b5e83 100644 --- a/src/imports/controls/designer/DialSpecifics.qml +++ b/src/imports/controls/designer/DialSpecifics.qml @@ -130,6 +130,19 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Input Mode") + tooltip: qsTr("How the dial tracks movement.") + } + SecondColumnLayout { + ComboBox { + backendValue: backendValues.inputMode + model: [ "Circular", "Horizontal", "Vertical" ] + scope: "Dial" + Layout.fillWidth: true + } + } } } diff --git a/src/imports/controls/fusion/qquickfusionstyle.cpp b/src/imports/controls/fusion/qquickfusionstyle.cpp index cb3889c8..98c1894f 100644 --- a/src/imports/controls/fusion/qquickfusionstyle.cpp +++ b/src/imports/controls/fusion/qquickfusionstyle.cpp @@ -43,21 +43,6 @@ QT_BEGIN_NAMESPACE -// On mac we want a standard blue color used when the system palette is used -static bool isMacSystemPalette(const QPalette &palette) -{ - Q_UNUSED(palette); -#if defined(Q_OS_MACOS) - const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette(); - if (themePalette && themePalette->color(QPalette::Normal, QPalette::Highlight) == - palette.color(QPalette::Normal, QPalette::Highlight) && - themePalette->color(QPalette::Normal, QPalette::HighlightedText) == - palette.color(QPalette::Normal, QPalette::HighlightedText)) - return true; -#endif - return false; -} - QQuickFusionStyle::QQuickFusionStyle(QObject *parent) : QObject(parent) { @@ -90,8 +75,6 @@ QColor QQuickFusionStyle::highlight(const QPalette &palette) QColor QQuickFusionStyle::highlightedText(const QPalette &palette) { - if (isMacSystemPalette(palette)) - return Qt::white; return palette.color(QPalette::HighlightedText); } diff --git a/src/imports/controls/fusion/qquickfusiontheme.cpp b/src/imports/controls/fusion/qquickfusiontheme.cpp index ac88563a..107619bf 100644 --- a/src/imports/controls/fusion/qquickfusiontheme.cpp +++ b/src/imports/controls/fusion/qquickfusiontheme.cpp @@ -37,12 +37,16 @@ #include "qquickfusiontheme_p.h" #include <QtQuickTemplates2/private/qquicktheme_p.h> +#include <QtQuickControls2/private/qquickstyle_p.h> QT_BEGIN_NAMESPACE void QQuickFusionTheme::initialize(QQuickTheme *theme) { - Q_UNUSED(theme); + const bool isDarkSystemTheme = QQuickStylePrivate::isDarkSystemTheme(); + QPalette systemPalette; + systemPalette.setColor(QPalette::ButtonText, isDarkSystemTheme ? Qt::white : Qt::black); + theme->setPalette(QQuickTheme::System, systemPalette); } QT_END_NAMESPACE diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 949eea62..4585a9a6 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -1105,8 +1105,12 @@ Module { name: "QQuickDial" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Dial 2.0", "QtQuick.Templates/Dial 2.2"] - exportMetaObjectRevisions: [0, 2] + exports: [ + "QtQuick.Templates/Dial 2.0", + "QtQuick.Templates/Dial 2.2", + "QtQuick.Templates/Dial 2.5" + ] + exportMetaObjectRevisions: [0, 2, 5] Enum { name: "SnapMode" values: { @@ -1115,6 +1119,14 @@ Module { "SnapOnRelease": 2 } } + Enum { + name: "InputMode" + values: { + "Circular": 0, + "Horizontal": 1, + "Vertical": 2 + } + } Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } Property { name: "value"; type: "double" } @@ -1126,8 +1138,10 @@ Module { Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "handle"; type: "QQuickItem"; isPointer: true } Property { name: "live"; revision: 2; type: "bool" } + Property { name: "inputMode"; revision: 5; type: "InputMode" } Signal { name: "moved"; revision: 2 } Signal { name: "liveChanged"; revision: 2 } + Signal { name: "inputModeChanged"; revision: 5 } Method { name: "increase" } Method { name: "decrease" } } @@ -1195,23 +1209,11 @@ Module { "Footer": 1 } } - Enum { - name: "ButtonLayout" - values: { - "UnknownLayout": -1, - "WinLayout": 0, - "MacLayout": 1, - "KdeLayout": 2, - "GnomeLayout": 3, - "MacModelessLayout": 4, - "AndroidLayout": 5 - } - } Property { name: "position"; type: "Position" } Property { name: "alignment"; type: "Qt::Alignment" } Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "buttonLayout"; revision: 5; type: "ButtonLayout" } + Property { name: "buttonLayout"; revision: 5; type: "QPlatformDialogHelper::ButtonLayout" } Signal { name: "accepted" } Signal { name: "rejected" } Signal { name: "helpRequested" } @@ -1295,13 +1297,26 @@ Module { prototype: "QQuickText" exports: [ "QtQuick.Templates/Label 2.0", - "QtQuick.Templates/Label 2.3" + "QtQuick.Templates/Label 2.3", + "QtQuick.Templates/Label 2.5" ] - exportMetaObjectRevisions: [0, 3] + exportMetaObjectRevisions: [0, 3, 5] Property { name: "font"; type: "QFont" } Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "palette"; revision: 3; type: "QPalette" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "paletteChanged"; revision: 3 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickMenu" @@ -2247,6 +2262,12 @@ Module { Property { name: "hoverEnabled"; revision: 1; type: "bool" } Property { name: "palette"; revision: 3; type: "QPalette" } Property { name: "placeholderTextColor"; revision: 5; type: "QColor" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { @@ -2267,6 +2288,12 @@ Module { Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "paletteChanged"; revision: 3 } Signal { name: "placeholderTextColorChanged"; revision: 5 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickTextAreaAttached" @@ -2294,6 +2321,12 @@ Module { Property { name: "hoverEnabled"; revision: 1; type: "bool" } Property { name: "palette"; revision: 3; type: "QPalette" } Property { name: "placeholderTextColor"; revision: 5; type: "QColor" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { @@ -2314,6 +2347,12 @@ Module { Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "paletteChanged"; revision: 3 } Signal { name: "placeholderTextColorChanged"; revision: 5 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickToolBar" diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 5bbbe422..a03cbd06 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -278,6 +278,10 @@ QList<QQuickStylePlugin *> QtQuickControls2Plugin::loadStylePlugins() // release versions of the same Qt libraries (due to the plugin's dependencies). filePath += QStringLiteral("_debug"); #endif // Q_OS_MACOS && QT_DEBUG +#if defined(Q_OS_WIN) && defined(QT_DEBUG) + // Debug versions of plugins have a "d" prefix on Windows. + filePath += QLatin1Char('d'); +#endif // Q_OS_WIN && QT_DEBUG loader.setFileName(filePath); QQuickStylePlugin *stylePlugin = qobject_cast<QQuickStylePlugin *>(loader.instance()); if (stylePlugin) diff --git a/src/imports/platform/qquickplatformfiledialog.cpp b/src/imports/platform/qquickplatformfiledialog.cpp index 36eaedf9..9c1eb684 100644 --- a/src/imports/platform/qquickplatformfiledialog.cpp +++ b/src/imports/platform/qquickplatformfiledialog.cpp @@ -518,7 +518,9 @@ void QQuickPlatformFileDialog::onShow(QPlatformDialogHelper *dialog) { m_options->setWindowTitle(title()); if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog)) { - fileDialog->setOptions(m_options); + fileDialog->setOptions(m_options); // setOptions only assigns a member and isn't virtual + if (m_firstShow && m_options->initialDirectory().isValid()) + fileDialog->setDirectory(m_options->initialDirectory()); if (m_selectedNameFilter) { const int index = m_selectedNameFilter->index(); const QString filter = m_options->nameFilters().value(index); @@ -527,6 +529,8 @@ void QQuickPlatformFileDialog::onShow(QPlatformDialogHelper *dialog) connect(fileDialog, &QPlatformFileDialogHelper::filterSelected, m_selectedNameFilter, &QQuickPlatformFileNameFilter::update); } } + if (m_firstShow) + m_firstShow = false; } void QQuickPlatformFileDialog::onHide(QPlatformDialogHelper *dialog) diff --git a/src/imports/platform/qquickplatformfiledialog_p.h b/src/imports/platform/qquickplatformfiledialog_p.h index d16cc2b4..b867f3c8 100644 --- a/src/imports/platform/qquickplatformfiledialog_p.h +++ b/src/imports/platform/qquickplatformfiledialog_p.h @@ -149,6 +149,7 @@ private: FileMode m_fileMode; QList<QUrl> m_files; + bool m_firstShow = true; QSharedPointer<QFileDialogOptions> m_options; mutable QQuickPlatformFileNameFilter *m_selectedNameFilter; }; diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes index 96c1b5c0..e9404fea 100644 --- a/src/imports/templates/plugins.qmltypes +++ b/src/imports/templates/plugins.qmltypes @@ -463,8 +463,12 @@ Module { name: "QQuickDial" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Dial 2.0", "QtQuick.Templates/Dial 2.2"] - exportMetaObjectRevisions: [0, 2] + exports: [ + "QtQuick.Templates/Dial 2.0", + "QtQuick.Templates/Dial 2.2", + "QtQuick.Templates/Dial 2.5" + ] + exportMetaObjectRevisions: [0, 2, 5] Enum { name: "SnapMode" values: { @@ -473,6 +477,14 @@ Module { "SnapOnRelease": 2 } } + Enum { + name: "InputMode" + values: { + "Circular": 0, + "Horizontal": 1, + "Vertical": 2 + } + } Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } Property { name: "value"; type: "double" } @@ -484,8 +496,10 @@ Module { Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "handle"; type: "QQuickItem"; isPointer: true } Property { name: "live"; revision: 2; type: "bool" } + Property { name: "inputMode"; revision: 5; type: "InputMode" } Signal { name: "moved"; revision: 2 } Signal { name: "liveChanged"; revision: 2 } + Signal { name: "inputModeChanged"; revision: 5 } Method { name: "increase" } Method { name: "decrease" } } @@ -553,23 +567,11 @@ Module { "Footer": 1 } } - Enum { - name: "ButtonLayout" - values: { - "UnknownLayout": -1, - "WinLayout": 0, - "MacLayout": 1, - "KdeLayout": 2, - "GnomeLayout": 3, - "MacModelessLayout": 4, - "AndroidLayout": 5 - } - } Property { name: "position"; type: "Position" } Property { name: "alignment"; type: "Qt::Alignment" } Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "buttonLayout"; revision: 5; type: "ButtonLayout" } + Property { name: "buttonLayout"; revision: 5; type: "QPlatformDialogHelper::ButtonLayout" } Signal { name: "accepted" } Signal { name: "rejected" } Signal { name: "helpRequested" } @@ -653,13 +655,26 @@ Module { prototype: "QQuickText" exports: [ "QtQuick.Templates/Label 2.0", - "QtQuick.Templates/Label 2.3" + "QtQuick.Templates/Label 2.3", + "QtQuick.Templates/Label 2.5" ] - exportMetaObjectRevisions: [0, 3] + exportMetaObjectRevisions: [0, 3, 5] Property { name: "font"; type: "QFont" } Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "palette"; revision: 3; type: "QPalette" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "paletteChanged"; revision: 3 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickMenu" @@ -1605,6 +1620,12 @@ Module { Property { name: "hoverEnabled"; revision: 1; type: "bool" } Property { name: "palette"; revision: 3; type: "QPalette" } Property { name: "placeholderTextColor"; revision: 5; type: "QColor" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { @@ -1625,6 +1646,12 @@ Module { Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "paletteChanged"; revision: 3 } Signal { name: "placeholderTextColorChanged"; revision: 5 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickTextAreaAttached" @@ -1652,6 +1679,12 @@ Module { Property { name: "hoverEnabled"; revision: 1; type: "bool" } Property { name: "palette"; revision: 3; type: "QPalette" } Property { name: "placeholderTextColor"; revision: 5; type: "QColor" } + Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } + Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "topInset"; revision: 5; type: "double" } + Property { name: "leftInset"; revision: 5; type: "double" } + Property { name: "rightInset"; revision: 5; type: "double" } + Property { name: "bottomInset"; revision: 5; type: "double" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { @@ -1672,6 +1705,12 @@ Module { Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "paletteChanged"; revision: 3 } Signal { name: "placeholderTextColorChanged"; revision: 5 } + Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } + Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } + Signal { name: "topInsetChanged"; revision: 5 } + Signal { name: "leftInsetChanged"; revision: 5 } + Signal { name: "rightInsetChanged"; revision: 5 } + Signal { name: "bottomInsetChanged"; revision: 5 } } Component { name: "QQuickToolBar" diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp index 03f5f8e8..8559ad15 100644 --- a/src/quicktemplates2/qquickdialogbuttonbox.cpp +++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp @@ -241,8 +241,11 @@ void QQuickDialogButtonBoxPrivate::resizeContent() return; QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding()); - if (alignment != 0) - geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(contentWidth, contentHeight), geometry); + if (alignment != 0) { + qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->property("contentWidth").toReal(); + qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->property("contentHeight").toReal(); + geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry); + } contentItem->setPosition(geometry.topLeft()); contentItem->setSize(geometry.size()); diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index dcced8dc..e542e7e8 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -212,6 +212,9 @@ QT_BEGIN_NAMESPACE \snippet qtquickcontrols2-popup.qml centerIn + To ensure that the popup is positioned within the bounds of the enclosing + window, the \l margins property can be set to a non-negative value. + \sa {Popup Controls}, {Customizing Popup}, ApplicationWindow */ diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp index 69a57674..ebd8ff29 100644 --- a/src/quicktemplates2/qquickpopuppositioner.cpp +++ b/src/quicktemplates2/qquickpopuppositioner.cpp @@ -300,7 +300,7 @@ void QQuickPopupPositioner::addAncestorListeners(QQuickItem *item) QQuickItem *p = item; while (p) { - QQuickItemPrivate::get(p)->addItemChangeListener(this, AncestorChangeTypes); + QQuickItemPrivate::get(p)->updateOrAddItemChangeListener(this, AncestorChangeTypes); p = p->parentItem(); } } diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index 179dcb64..054ea502 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -848,7 +848,6 @@ void QQuickSlider::wheelEvent(QWheelEvent *event) const bool wasMoved = !qFuzzyCompare(d->value, oldValue); if (wasMoved) emit moved(); - event->setAccepted(wasMoved); } } #endif diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index ee7d0ae3..95dd9f93 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -96,6 +96,24 @@ QT_BEGIN_NAMESPACE \li Clips the content \endlist + \section2 Tab Focus + + By default, pressing the tab key while TextArea has + \l {Item::activeFocus}{active focus} results in a tab character being input + into the control itself. To make tab pass active focus onto another item, + use the attached \l KeyNavigation properties: + + \code + TextField { + id: textField + } + + TextArea { + KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.tab: textField + } + \endcode + \sa TextField, {Customizing TextArea}, {Input Controls} */ diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml index 43153c94..62789a47 100644 --- a/tests/auto/controls/data/tst_dialogbuttonbox.qml +++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml @@ -275,4 +275,21 @@ TestCase { compare(okButton.width + cancelButton.width, control.availableWidth - control.spacing) } + + function test_oneButtonInFixedWidthBox() { + var control = createTemporaryObject(buttonBox, testCase, + { width: 400, standardButtons: Dialog.Close }) + verify(control) + + var listView = control.contentItem + waitForRendering(listView) + + var button = control.itemAt(0) + verify(button) + + // The button should never go outside of the box. + var buttonPosInBox = button.mapToItem(control, 0, 0) + verify(buttonPosInBox.x >= 0) + verify(buttonPosInBox.x + button.width < control.width) + } } diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 2b3144a5..280138c5 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -772,6 +772,63 @@ TestCase { compare(control.position, 0.25) } + function test_wheelPropagation_data() { + return [ + { tag: "horizontal", orientation: Qt.Horizontal, dx: 120, dy: 0 }, + { tag: "vertical", orientation: Qt.Vertical, dx: 0, dy: 120 } + ] + } + + Component { + id: mouseAreaComponent + MouseArea {} + } + + function test_wheelPropagation(data) { + var mouseArea = createTemporaryObject(mouseAreaComponent, testCase, { width: parent.width, height: parent.height }) + verify(mouseArea) + + var mouseAreaWheelSpy = signalSpy.createObject(mouseArea, { target: mouseArea, signalName: "wheel" }) + verify(mouseAreaWheelSpy.valid) + + var control = createTemporaryObject(slider, mouseArea, + { wheelEnabled: true, orientation: data.orientation, stepSize: 1 }) + verify(control) + compare(control.value, 0.0) + + var movedCount = 0 + var movedSpy = signalSpy.createObject(control, { target: control, signalName: "moved" }) + verify(movedSpy.valid) + + // Scroll the handle to the edge. + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 1.0) + compare(control.position, 1.0) + compare(movedSpy.count, ++movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll again; the wheel event shouldn't go through to the MouseArea parent. + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 1.0) + compare(control.position, 1.0) + compare(movedSpy.count, movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll the handle to the other edge. + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 0.0) + compare(control.position, 0.0) + compare(movedSpy.count, ++movedCount) + compare(mouseAreaWheelSpy.count, 0) + + // Scroll again; the wheel event shouldn't go through to the MouseArea parent. + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 0.0) + compare(control.position, 0.0) + compare(movedSpy.count, movedCount) + compare(mouseAreaWheelSpy.count, 0) + } + function test_valueAt_data() { return [ { tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] }, diff --git a/tests/auto/qquickpopup/data/dialog.qml b/tests/auto/qquickpopup/data/dialog.qml new file mode 100644 index 00000000..ee1b6bde --- /dev/null +++ b/tests/auto/qquickpopup/data/dialog.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.12 + +Item { + width: 400 + height: 400 + objectName: "Rectangle" + + property alias dialog: dialog + + Dialog { + id: dialog + objectName: "Dialog" + width: 200 + height: 200 + anchors.centerIn: parent + visible: true + + Component.onCompleted: { + background.objectName = "DialogBackground" + contentItem.objectName = "DialogContentItem" + } + } +} diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 9230116b..35d05244 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -41,8 +41,10 @@ #include "../shared/qtest_quickcontrols.h" #include <QtGui/qpa/qwindowsysteminterface.h> +#include <QtQuick/qquickview.h> #include <QtQuickTemplates2/private/qquickapplicationwindow_p.h> #include <QtQuickTemplates2/private/qquickcombobox_p.h> +#include <QtQuickTemplates2/private/qquickdialog_p.h> #include <QtQuickTemplates2/private/qquickoverlay_p.h> #include <QtQuickTemplates2/private/qquickpopup_p.h> #include <QtQuickTemplates2/private/qquickbutton_p.h> @@ -83,6 +85,7 @@ private slots: void enabled(); void orientation_data(); void orientation(); + void qquickview(); }; void tst_QQuickPopup::initTestCase() @@ -1060,6 +1063,26 @@ void tst_QQuickPopup::orientation() QCOMPARE(popup->popupItem()->position(), position); } +void tst_QQuickPopup::qquickview() +{ + QQuickView view; + view.setObjectName("QQuickView"); + view.resize(400, 400); + view.setSource(testFileUrl("dialog.qml")); + QVERIFY(view.status() != QQuickView::Error); + view.contentItem()->setObjectName("QQuickViewContentItem"); + view.show(); + + QQuickDialog *dialog = view.rootObject()->property("dialog").value<QQuickDialog*>(); + QVERIFY(dialog); + QTRY_COMPARE(dialog->property("opened").toBool(), true); + + dialog->close(); + QTRY_COMPARE(dialog->property("visible").toBool(), false); + + // QTBUG-72746: shouldn't crash on application exit after closing a Dialog when using QQuickView. +} + QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup) #include "tst_qquickpopup.moc" diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp index f5207a96..3f55bcfb 100644 --- a/tests/auto/qquickstyle/tst_qquickstyle.cpp +++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp @@ -39,6 +39,7 @@ #include <QtQml/qqmlcomponent.h> #include <QtQuickControls2/qquickstyle.h> #include <QtQuickControls2/private/qquickstyle_p.h> +#include <QtQuickTemplates2/private/qquicktheme_p.h> #include <QtGui/private/qguiapplication_p.h> #include "../shared/util.h" @@ -102,6 +103,10 @@ void tst_QQuickStyle::lookup() loadControls(); + // The font size for editors in the (default) Normal variant is 16. + // If this is wrong, the style plugin may not have been loaded. + QCOMPARE(QQuickTheme::instance()->font(QQuickTheme::TextArea).pixelSize(), 16); + QCOMPARE(QQuickStyle::name(), QString("Material")); QVERIFY(!QQuickStyle::path().isEmpty()); } |