From ab31e883635f4b26a406500787a20ea6d95dc706 Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Fri, 11 Jan 2019 14:01:48 +0100 Subject: Doc: Give a hint to Popup's margins property in the positioning section Change-Id: I6878b06d67b6066da1ca187cd879b77b96539ddc Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 3 +++ 1 file changed, 3 insertions(+) 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 */ -- cgit v1.2.3 From 7b51dd69b7a871f799379203d066c899c2ffe304 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 14 Jan 2019 09:14:09 +0200 Subject: Bump version Change-Id: I0285c0bd03187fafa4f3261a877257f56242d24d --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From fa4b1aa6024f5f3b2d0e0502561b1eaedddd0c78 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 8 Jan 2019 14:01:13 +0100 Subject: QQuickPopupPositioner: fix crash on application exit Don't add duplicate change listeners, since only one of them will be removed. Coincidentally, this is the same fix as d56c193e, which was reverted for unrelated reasons as part of a bulk revert in d3545dbd. Change-Id: If6fde09f884929c7928f3a1f78625559c9fcbf07 Fixes: QTBUG-72746 Reviewed-by: Richard Moe Gustavsen --- src/quicktemplates2/qquickpopuppositioner.cpp | 2 +- tests/auto/qquickpopup/data/dialog.qml | 75 +++++++++++++++++++++++++++ tests/auto/qquickpopup/tst_qquickpopup.cpp | 23 ++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qquickpopup/data/dialog.qml 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/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 +#include #include #include +#include #include #include #include @@ -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(); + 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" -- cgit v1.2.3