aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-06-04 13:52:18 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-15 16:56:10 +0200
commit828cdcabf84734a753e3ba8b8e4b089a6e155415 (patch)
tree0bad81fccdc270b28988dc4dc27d047f0354b8c7
parentf2378620e1616a7ec1b277b57da9176ccb7828ae (diff)
Remove QtQuick.Window plugin
We move all the types into QtQuick itself and retain QtQuick.Window only as alias to QtQuick. This requires support for qmldirs that consist of only an import statement. [ChangeLog][QtQuick][Important Behavior Changes] The contents of the QtQuick.Window QML module have been moved into the QtQuick module. QtQuick.Window is merely and alias for QtQuick now. An explicit import of QtQuick will override this alias. Therefore, if you import QtQuick with a different version than QtQuick.Window, you will get the QtQuick.Window types of the version given in the QtQuick import now. Task-number: QTBUG-84639 Change-Id: Ia82afab0ac2faba70cfdaf53dc8dfe4261e1113f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--examples/quick/window/AllScreens.qml3
-rw-r--r--examples/quick/window/CurrentScreen.qml3
-rw-r--r--examples/quick/window/Splash.qml3
-rw-r--r--examples/quick/window/window.qml3
-rw-r--r--src/imports/CMakeLists.txt1
-rw-r--r--src/imports/imports.pro3
-rw-r--r--src/imports/window/CMakeLists.txt26
-rw-r--r--src/imports/window/plugin.cpp79
-rw-r--r--src/imports/window/plugin.h131
-rw-r--r--src/imports/window/qmldir5
-rw-r--r--src/imports/window/window.pro15
-rw-r--r--src/qml/qml/qqmlimport.cpp2
-rw-r--r--src/quick/CMakeLists.txt16
-rw-r--r--src/quick/items/qquickscreen_p.h8
-rw-r--r--src/quick/items/qquickwindow.h4
-rw-r--r--src/quick/items/qquickwindow_p.h2
-rw-r--r--src/quick/items/qquickwindowattached_p.h2
-rw-r--r--src/quick/items/qquickwindowmodule_p.h10
-rw-r--r--src/quick/quick.pro6
-rw-r--r--tests/auto/qml/debugger/qqmlpreview/data/zoom.qml3
-rw-r--r--tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml3
-rw-r--r--tests/auto/quick/qquickloader/data/itemLoaderItemWindow.qml3
-rw-r--r--tests/auto/quick/qquickloader/data/itemLoaderWindow.qml3
-rw-r--r--tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml3
24 files changed, 59 insertions, 278 deletions
diff --git a/examples/quick/window/AllScreens.qml b/examples/quick/window/AllScreens.qml
index 0cec36c0ab..4050c09870 100644
--- a/examples/quick/window/AllScreens.qml
+++ b/examples/quick/window/AllScreens.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,7 +49,6 @@
****************************************************************************/
import QtQuick 2.3
-import QtQuick.Window 2.3
import "../shared" as Shared
Column {
diff --git a/examples/quick/window/CurrentScreen.qml b/examples/quick/window/CurrentScreen.qml
index 563cca32a5..df5e876b3d 100644
--- a/examples/quick/window/CurrentScreen.qml
+++ b/examples/quick/window/CurrentScreen.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,7 +49,6 @@
****************************************************************************/
import QtQuick 2.3
-import QtQuick.Window 2.10
import "../shared" as Shared
Item {
diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml
index b33ad6c168..a6f70a59ef 100644
--- a/examples/quick/window/Splash.qml
+++ b/examples/quick/window/Splash.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,7 +49,6 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.1
//! [splash-properties]
Window {
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml
index 4280b6a4c0..499c9935f7 100644
--- a/examples/quick/window/window.qml
+++ b/examples/quick/window/window.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,7 +49,6 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.3
import "../shared" as Shared
QtObject {
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
index 020f683e41..9970e5a39d 100644
--- a/src/imports/CMakeLists.txt
+++ b/src/imports/CMakeLists.txt
@@ -23,7 +23,6 @@ if(TARGET Qt::Quick)
add_subdirectory(labsanimation)
add_subdirectory(layouts)
add_subdirectory(qtquick2)
- add_subdirectory(window)
endif()
if(QT_FEATURE_quick_shadereffect AND TARGET Qt::Quick)
add_subdirectory(wavefrontmesh)
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index e0f66838ec..0ea9395179 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -19,8 +19,7 @@ qtHaveModule(quick) {
SUBDIRS += \
labsanimation \
layouts \
- qtquick2 \
- window
+ qtquick2
qtConfig(quick-shadereffect): SUBDIRS += wavefrontmesh
diff --git a/src/imports/window/CMakeLists.txt b/src/imports/window/CMakeLists.txt
deleted file mode 100644
index 99cedf333c..0000000000
--- a/src/imports/window/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from window.pro.
-
-#####################################################################
-## windowplugin Plugin:
-#####################################################################
-
-qt_add_qml_module(windowplugin
- URI "QtQuick.Window"
- VERSION "${CMAKE_PROJECT_VERSION}"
- DESIGNER_SUPPORTED
- CLASSNAME QtQuick2WindowPlugin
- SKIP_TYPE_REGISTRATION
- GENERATE_QMLTYPES
- SOURCES
- plugin.cpp plugin.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::QmlPrivate
- Qt::QuickPrivate
-)
-
-#### Keys ignored in scope 1:.:.:window.pro:<TRUE>:
-# CXX_MODULE = "qml"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-# TARGETPATH = "QtQuick/Window"
diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp
deleted file mode 100644
index 5152fa02ec..0000000000
--- a/src/imports/window/plugin.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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.
-**
-** 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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqmlextensionplugin.h>
-
-#include "plugin.h"
-
-extern void qml_register_types_QtQuick_Window();
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlmodule QtQuick.Window 2.\QtMinorVersion
- \title Qt Quick Window QML Types
- \ingroup qmlmodules
- \brief Provides QML types for window management
-
- This QML module contains types for creating top-level windows and accessing screen information.
-
- To use the types in this module, import the module with the following line:
-
- \qml \QtMinorVersion
- import QtQuick.Window 2.\1
- \endqml
-*/
-
-//![class decl]
-class QtQuick2WindowPlugin : public QQmlEngineExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
-public:
- QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
- {
- volatile auto registration = &qml_register_types_QtQuick_Window;
- Q_UNUSED(registration);
- }
-};
-//![class decl]
-
-QT_END_NAMESPACE
-
-#include "plugin.moc"
diff --git a/src/imports/window/plugin.h b/src/imports/window/plugin.h
deleted file mode 100644
index 625a77b12c..0000000000
--- a/src/imports/window/plugin.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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.
-**
-** 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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLUGIN_H
-#define PLUGIN_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qwindow_p.h>
-#include <QtQuick/private/qquickwindow_p.h>
-#include <QtQuick/private/qquickwindowattached_p.h>
-#include <QtQuick/private/qquickscreen_p.h>
-#include <QtQuick/private/qquickwindowmodule_p.h>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QWindowForeign
-{
- Q_GADGET
- QML_FOREIGN(QWindow)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(2, 1)
-};
-
-struct QQuickWindowForeign
-{
- Q_GADGET
- QML_FOREIGN(QQuickWindow)
- QML_NAMED_ELEMENT(Window)
- QML_ADDED_IN_VERSION(2, 0)
- QML_REMOVED_IN_VERSION(2, 1)
-};
-
-struct QQuickWindowForeignAttached
-{
- Q_GADGET
- QML_FOREIGN(QQuickWindowAttached)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(2, 0)
-};
-
-struct QQuickScreenInfoForeign
-{
- Q_GADGET
- QML_FOREIGN(QQuickScreenInfo)
- QML_NAMED_ELEMENT(ScreenInfo)
- QML_ADDED_IN_VERSION(2, 3)
- QML_UNCREATABLE("ScreenInfo can only be used via the attached property.")
-};
-
-struct QQuickScreenForeignAttached
-{
- Q_GADGET
- QML_FOREIGN(QQuickScreenAttached)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(2, 0)
-};
-
-struct QQuickScreenForeign
-{
- Q_GADGET
- QML_FOREIGN(QQuickScreen)
- QML_NAMED_ELEMENT(Screen)
- QML_ADDED_IN_VERSION(2, 0)
- QML_UNCREATABLE("Screen can only be used via the attached property.")
-};
-
-struct QQuickWindowQmlImplForeign
-{
- Q_GADGET
- QML_FOREIGN(QQuickWindowQmlImpl)
- QML_NAMED_ELEMENT(Window)
- QML_ADDED_IN_VERSION(2, 1)
-};
-
-struct QQuickRootItemForeign
-{
- Q_GADGET
- QML_FOREIGN(QQuickRootItem)
- QML_ANONYMOUS
-};
-
-QT_END_NAMESPACE
-
-#endif // PLUGIN_H
diff --git a/src/imports/window/qmldir b/src/imports/window/qmldir
index fb6202b3bb..859cd341a1 100644
--- a/src/imports/window/qmldir
+++ b/src/imports/window/qmldir
@@ -1,5 +1,2 @@
module QtQuick.Window
-plugin windowplugin
-classname QtQuick2WindowPlugin
-typeinfo plugins.qmltypes
-designersupported
+import QtQuick
diff --git a/src/imports/window/window.pro b/src/imports/window/window.pro
deleted file mode 100644
index d8f9b16df4..0000000000
--- a/src/imports/window/window.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-CXX_MODULE = qml
-TARGET = windowplugin
-TARGETPATH = QtQuick/Window
-QML_IMPORT_VERSION = $$QT_VERSION
-
-SOURCES += \
- plugin.cpp
-
-HEADERS += \
- plugin.h
-
-QT += quick-private qml-private
-
-CONFIG += qmltypes install_qmltypes
-load(qml_plugin)
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 275c53cfda..a5429afd12 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1585,6 +1585,8 @@ bool QQmlImportsPrivate::addLibraryImport(
// Ensure that we are actually providing something
if (!QQmlMetaType::isModule(uri, version)) {
if (inserted->qmlDirComponents.isEmpty() && inserted->qmlDirScripts.isEmpty()) {
+ if (qmldir.plugins().isEmpty() && !qmldir.imports().isEmpty())
+ return true; // This is a pure redirection
QQmlError error;
if (QQmlMetaType::isAnyModule(uri)) {
error.setDescription(QQmlImportDatabase::tr(
diff --git a/src/quick/CMakeLists.txt b/src/quick/CMakeLists.txt
index 8bf934ef05..74e1f494d7 100644
--- a/src/quick/CMakeLists.txt
+++ b/src/quick/CMakeLists.txt
@@ -287,6 +287,8 @@ endif()
# QMLTYPES_INSTALL_DIR = "$$[QT_INSTALL_QML]/QtQuick"
# QML_IMPORT_NAME = "QtQuick"
# QML_IMPORT_VERSION = "$$QT_VERSION"
+# qmldir.files = "$$PWD/../imports/window/qmldir"
+# qmldir.path = "$$[QT_INSTALL_QML]/QtQuick/Window"
## Scopes:
#####################################################################
@@ -358,6 +360,12 @@ qt_extend_target(Quick CONDITION QT_FEATURE_accessibility
Qt::QmlPrivate
)
+#### Keys ignored in scope 10:.:.:quick.pro:prefix_build:
+# INSTALLS = "qmldir"
+
+#### Keys ignored in scope 11:.:.:quick.pro:else:
+# COPIES = "qmldir"
+
qt_extend_target(Quick CONDITION QT_FEATURE_qml_debug
SOURCES
util/qquickprofiler.cpp
@@ -533,3 +541,11 @@ set_target_properties(Quick PROPERTIES
)
qt6_qml_type_registration(Quick)
+
+#special case begin
+if (QT_WILL_INSTALL)
+ install(FILES ../imports/window/qmldir DESTINATION "${INSTALL_QMLDIR}/QtQuick/Window")
+else()
+ file(COPY ../imports/window/qmldir DESTINATION "${QT_BUILD_DIR}/${INSTALL_QMLDIR}/QtQuick/Window")
+endif()
+#special case end
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index d0f1627e37..af496be2e6 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -81,8 +81,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScreenInfo : public QObject
Q_PROPERTY(int virtualX READ virtualX NOTIFY virtualXChanged REVISION(2, 3))
Q_PROPERTY(int virtualY READ virtualY NOTIFY virtualYChanged REVISION(2, 3))
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(2, 0)
+ QML_NAMED_ELEMENT(ScreenInfo)
+ QML_ADDED_IN_VERSION(2, 3)
+ QML_UNCREATABLE("ScreenInfo can only be used via the attached property.")
public:
QQuickScreenInfo(QObject *parent = nullptr, QScreen *wrappedScreen = nullptr);
@@ -153,6 +154,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScreen : public QObject
{
Q_OBJECT
QML_ATTACHED(QQuickScreenAttached)
+ QML_NAMED_ELEMENT(Screen)
+ QML_ADDED_IN_VERSION(2, 0)
+ QML_UNCREATABLE("Screen can only be used via the attached property.")
public:
static QQuickScreenAttached *qmlAttachedProperties(QObject *object){ return new QQuickScreenAttached(object); }
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 1b87d01f96..132030cc61 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -77,6 +77,10 @@ class Q_QUICK_EXPORT QQuickWindow : public QWindow
Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION(2, 1))
Q_CLASSINFO("DefaultProperty", "data")
Q_DECLARE_PRIVATE(QQuickWindow)
+
+ QML_NAMED_ELEMENT(Window)
+ QML_ADDED_IN_VERSION(2, 0)
+ QML_REMOVED_IN_VERSION(2, 1)
public:
enum CreateTextureOption {
TextureHasAlphaChannel = 0x0001,
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 3141ef6b55..0c2c86555d 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -92,6 +92,8 @@ class QRhiTexture;
class Q_QUICK_PRIVATE_EXPORT QQuickRootItem : public QQuickItem
{
Q_OBJECT
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(2, 0)
public:
QQuickRootItem();
public Q_SLOTS:
diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h
index 191f22137c..df6ab9b46a 100644
--- a/src/quick/items/qquickwindowattached_p.h
+++ b/src/quick/items/qquickwindowattached_p.h
@@ -71,6 +71,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowAttached : public QObject
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(QQuickWindow *window READ window NOTIFY windowChanged)
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(2, 0)
public:
QQuickWindowAttached(QObject* attachee);
diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h
index 87f0b240b8..7177469b55 100644
--- a/src/quick/items/qquickwindowmodule_p.h
+++ b/src/quick/items/qquickwindowmodule_p.h
@@ -60,6 +60,14 @@ QT_BEGIN_NAMESPACE
class QQuickWindowQmlImplPrivate;
+struct QWindowForeign
+{
+ Q_GADGET
+ QML_FOREIGN(QWindow)
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(2, 1)
+};
+
class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus
{
Q_OBJECT
@@ -69,6 +77,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public Q
Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
Q_PROPERTY(QObject *screen READ screen WRITE setScreen NOTIFY screenChanged REVISION(2, 3))
QML_ATTACHED(QQuickWindowAttached)
+ QML_NAMED_ELEMENT(Window)
+ QML_ADDED_IN_VERSION(2, 1)
public:
QQuickWindowQmlImpl(QWindow *parent = nullptr);
diff --git a/src/quick/quick.pro b/src/quick/quick.pro
index f7a5b81a2a..43abc477f7 100644
--- a/src/quick/quick.pro
+++ b/src/quick/quick.pro
@@ -57,3 +57,9 @@ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick
QML_IMPORT_NAME = QtQuick
QML_IMPORT_VERSION = $$QT_VERSION
CONFIG += qmltypes install_qmltypes install_metatypes
+
+# Install QtQuick.Window qmldir
+qmldir.files = $$PWD/../imports/window/qmldir
+qmldir.path = $$[QT_INSTALL_QML]/QtQuick/Window
+prefix_build: INSTALLS += qmldir
+else: COPIES += qmldir
diff --git a/tests/auto/qml/debugger/qqmlpreview/data/zoom.qml b/tests/auto/qml/debugger/qqmlpreview/data/zoom.qml
index 0aca235de1..702f8534d7 100644
--- a/tests/auto/qml/debugger/qqmlpreview/data/zoom.qml
+++ b/tests/auto/qml/debugger/qqmlpreview/data/zoom.qml
@@ -26,8 +26,7 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Window 2.2
+import QtQuick
Window {
id: w
diff --git a/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml b/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml
index 30fc844d7a..df46486d6b 100644
--- a/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml
+++ b/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml
@@ -1,5 +1,4 @@
-import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick
Window {
Component {
diff --git a/tests/auto/quick/qquickloader/data/itemLoaderItemWindow.qml b/tests/auto/quick/qquickloader/data/itemLoaderItemWindow.qml
index d4c5daecab..e4e6088ebe 100644
--- a/tests/auto/quick/qquickloader/data/itemLoaderItemWindow.qml
+++ b/tests/auto/quick/qquickloader/data/itemLoaderItemWindow.qml
@@ -1,5 +1,4 @@
-import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick
Item {
width: 400
diff --git a/tests/auto/quick/qquickloader/data/itemLoaderWindow.qml b/tests/auto/quick/qquickloader/data/itemLoaderWindow.qml
index 69421448e0..e3eb0f7e9a 100644
--- a/tests/auto/quick/qquickloader/data/itemLoaderWindow.qml
+++ b/tests/auto/quick/qquickloader/data/itemLoaderWindow.qml
@@ -1,5 +1,4 @@
-import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick
Item {
width: 400
diff --git a/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml b/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml
index 48c4d1d69f..e7cef1ad59 100644
--- a/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml
+++ b/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml
@@ -1,5 +1,4 @@
-import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick
Window {
width: 200