summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarco Martin <mart@kde.org>2015-04-27 17:04:30 +0200
committerMarco Martin <mart@kde.org>2015-08-03 08:51:16 +0000
commitc717082c098bbfc96848457436ca83db7b83e4c8 (patch)
tree828e661036453bbcaf1015078bf1e83a9ce1e938 /tests
parent560fa0b9ec9ac0af53baf717ff83a51f1cd0762b (diff)
downloadqtquickcontrols-c717082c098bbfc96848457436ca83db7b83e4c8.tar.gz
Adjust popup position by offset of the view in the toplevel window
In the case a view is embedded in a QWidget, such widget may be embedded anywhere in parent widgets. if it's not at a 0,0 position compared to the toplevel widget, the position needs to be adjusted by the relative position of the QQuickWindow in regards to the toplevel one, in which in this case is given by transientParent() Change-Id: Iafb7a42bdb641850fe77932d14bac9a715059b37 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/viewinqwidget/main.cpp54
-rw-r--r--tests/manual/viewinqwidget/main.qml50
-rw-r--r--tests/manual/viewinqwidget/viewinqwidget.pro6
3 files changed, 110 insertions, 0 deletions
diff --git a/tests/manual/viewinqwidget/main.cpp b/tests/manual/viewinqwidget/main.cpp
new file mode 100644
index 00000000..06131641
--- /dev/null
+++ b/tests/manual/viewinqwidget/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QQuickView>
+#include <QWidget>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QQuickView *view = new QQuickView;
+ QWidget widget;
+ QWidget *container = QWidget::createWindowContainer(view, &widget);
+ container->setGeometry(100,100,300,300);
+
+ view->setSource(QUrl(QStringLiteral("main.qml")));
+ widget.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/viewinqwidget/main.qml b/tests/manual/viewinqwidget/main.qml
new file mode 100644
index 00000000..29d65ae2
--- /dev/null
+++ b/tests/manual/viewinqwidget/main.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.3
+
+Item {
+ visible: true
+ width: 360
+ height: 360
+
+
+ ComboBox {
+ anchors.centerIn: parent
+ model: [ "Banana", "Apple", "Coconut" ]
+ }
+}
diff --git a/tests/manual/viewinqwidget/viewinqwidget.pro b/tests/manual/viewinqwidget/viewinqwidget.pro
new file mode 100644
index 00000000..fb0f24f4
--- /dev/null
+++ b/tests/manual/viewinqwidget/viewinqwidget.pro
@@ -0,0 +1,6 @@
+QT += qml quick widgets
+TARGET = viewinqwidget
+SOURCES += $$PWD/main.cpp
+
+OTHER_FILES += \
+ qml/main.qml