From db286068f352291416d1fce9fe9953f376b74798 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 24 Jan 2017 13:57:29 +0100 Subject: QQuickPopup: allow window change after component completion When visible has been set true, don't attempt to start the enter transition from componentComplete(), but wait until the popup is associated with a window. This makes it possible to share a single QQuickView instance for all data rows in tst_snippets. Task-number: QTBUG-58196 Change-Id: I9204e0d2e6468a21ee36f313daedc43d2e919ec6 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 4852d08d..b07adeb6 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -431,6 +431,9 @@ void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow) window = newWindow; emit q->windowChanged(newWindow); + + if (complete && visible && window) + transitionManager.transitionEnter(); } class QQuickPopupItemPrivate : public QQuickControlPrivate @@ -2215,15 +2218,17 @@ void QQuickPopup::classBegin() void QQuickPopup::componentComplete() { Q_D(QQuickPopup); - d->complete = true; if (!parentItem()) { if (QQuickItem *item = qobject_cast(parent())) setParentItem(item); else if (QQuickWindow *window = qobject_cast(parent())) setParentItem(window->contentItem()); } - if (d->visible) + + if (d->visible && d->window) d->transitionManager.transitionEnter(); + + d->complete = true; d->popupItem->componentComplete(); } -- cgit v1.2.3 From e6cc5382d9b789274d3e16e8601f33075b6a4b1c Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 3 Jan 2017 13:46:46 +0100 Subject: Fix a crash with focus handling when destructing QQAppWindow Because QQuickApplicationWindow connected SIGNAL(activeFocusItemChanged()) to SLOT(_q_updateActiveFocus())); it would enter _q_updateActiveFocus() from the dtor of QQuickWindow (because dtor of QQuickWindow would emit activeFocusItemChanged()). At that point the QQuickApplicationWindow object for the member function _q_updateActiveFocus() was already destroyed, so we would crash. Instead, make sure we clear the focus as early as possible, and then disconnect in case activeFocusItemChanged() is emitted after QQuickApplicationWindow is destroyed. Task-number: QTBUG-57846 Change-Id: I4b1999e647b970394436a2d462b7f352f1c8a811 Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickapplicationwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index a79216b1..0123786a 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -293,6 +293,8 @@ QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) : QQuickApplicationWindow::~QQuickApplicationWindow() { Q_D(QQuickApplicationWindow); + d->setActiveFocusControl(nullptr); + disconnect(this, SIGNAL(activeFocusItemChanged()), this, SLOT(_q_updateActiveFocus())); if (d->header) QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); -- cgit v1.2.3 From 146d54036664a3f19c2e6d2119f1a1d4acf55fa1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 8 Feb 2017 14:54:15 +0100 Subject: Editors: fix mouse cursor Read-only editors should not use the IBeam cursor, but switch to a plain arrow cursor. Change-Id: If579571ceff086af6b8259ade769b5efb27565db Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktextarea.cpp | 6 ++++-- src/quicktemplates2/qquicktextfield.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index cf6b4274..5d710d4e 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -375,11 +375,13 @@ void QQuickTextAreaPrivate::updateHoverEnabled(bool enabled, bool xplicit) void QQuickTextAreaPrivate::_q_readOnlyChanged(bool isReadOnly) { + Q_UNUSED(isReadOnly); #ifndef QT_NO_ACCESSIBILITY if (accessibleAttached) accessibleAttached->set_readOnly(isReadOnly); -#else - Q_UNUSED(isReadOnly) +#endif +#ifndef QT_NO_CURSOR + q_func()->setCursor(isReadOnly ? Qt::ArrowCursor : Qt::IBeamCursor); #endif } diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index 4c916381..2718b13e 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -239,11 +239,13 @@ void QQuickTextFieldPrivate::updateHoverEnabled(bool enabled, bool xplicit) void QQuickTextFieldPrivate::_q_readOnlyChanged(bool isReadOnly) { + Q_UNUSED(isReadOnly); #ifndef QT_NO_ACCESSIBILITY if (accessibleAttached) accessibleAttached->set_readOnly(isReadOnly); -#else - Q_UNUSED(isReadOnly) +#endif +#ifndef QT_NO_CURSOR + q_func()->setCursor(isReadOnly ? Qt::ArrowCursor : Qt::IBeamCursor); #endif } -- cgit v1.2.3 From e91c9feab8a0cf4cff71cc68ab0f001b1531504f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 20 Feb 2017 15:34:26 +0100 Subject: Add missing QML type registrations For the internal Radio and CheckIndicator types. Task-number: QTBUG-59026 Change-Id: I7e34f29e33ebd3d748892df0ba1592fe8ae5ed44 Reviewed-by: Mitch Curtis --- src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp | 1 + src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp index 94941b4c..61466f66 100644 --- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp +++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp @@ -99,6 +99,7 @@ void QtQuickControls2MaterialStylePlugin::initializeEngine(QQmlEngine *engine, c qmlRegisterType(typeUrl(QStringLiteral("BoxShadow.qml")), import, 2, 0, "BoxShadow"); qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect"); + qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); qmlRegisterType(typeUrl(QStringLiteral("RectangularGlow.qml")), import, 2, 0, "RectangularGlow"); qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle"); qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator"); diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp index 81d61169..fb3563fc 100644 --- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp +++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp @@ -94,6 +94,7 @@ void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine, qmlRegisterType(import, 2, 0, "ProgressStrip"); qmlRegisterType(import, 2, 0, "ProgressStripAnimator"); + qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator"); } -- cgit v1.2.3