aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2024-03-12 15:44:53 +0800
committerMitch Curtis <mitch.curtis@qt.io>2024-03-15 09:19:36 +0800
commite9f53d023d50a4367392db86c08843bbf10c947d (patch)
tree4fd49d86007d328d2e102067f1ddc417cbf86e76 /src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h
parentd5cd8ac31577f4feecb0934f30f58af25261b5b1 (diff)
Use document imports of QtQuick.Controls.impl, not qmldir-imports
qmldir-imports are transitive, meaning that we were exposing all types from QtQuick.Controls.impl each time QtQuick.Controls was imported. This patch removes these transitive qmldir-imports by moving the foreign type declarations for QQuickOverlay and QQuickSplitHandleAttached into the Basic style (which is always imported by every style as a final fallback). Task-number: QTBUG-104768 Task-number: QTBUG-123103 Change-Id: Ia0ff778a88a38bb872730e055631dc924456d7be Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h')
-rw-r--r--src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h b/src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h
new file mode 100644
index 0000000000..203a1c69a3
--- /dev/null
+++ b/src/quickcontrols/basic/qtquickcontrols2basicforeign_p.h
@@ -0,0 +1,51 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QTQUICKCONTROLS2BASICFOREIGN_P_H
+#define QTQUICKCONTROLS2BASICFOREIGN_P_H
+
+#include <QtQml/qqml.h>
+#include <QtQuickTemplates2/private/qquickoverlay_p.h>
+#if QT_CONFIG(quicktemplates2_container)
+#include <QtQuickTemplates2/private/qquicksplitview_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+//
+// 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.
+//
+
+// These are necessary in order to use C++ types in a file where only QtQuick.Controls has been imported.
+// Control types like Button don't need this done for them, as each style module provides a Button type,
+// and QtQuick.Controls is a sort of alias for the active style import.
+
+struct QQuickOverlayAttachedForeign
+{
+ Q_GADGET
+ QML_NAMED_ELEMENT(Overlay)
+ QML_FOREIGN(QQuickOverlay)
+ QML_UNCREATABLE("")
+ QML_ADDED_IN_VERSION(2, 3)
+};
+
+#if QT_CONFIG(quicktemplates2_container)
+struct QQuickSplitHandleAttachedForeign
+{
+ Q_GADGET
+ QML_NAMED_ELEMENT(SplitHandle)
+ QML_FOREIGN(QQuickSplitHandleAttached)
+ QML_UNCREATABLE("")
+ QML_ADDED_IN_VERSION(2, 13)
+};
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCONTROLS2BASICFOREIGN_P_H