aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquicktemplatesutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates/qquicktemplatesutils.cpp')
-rw-r--r--src/quicktemplates/qquicktemplatesutils.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/quicktemplates/qquicktemplatesutils.cpp b/src/quicktemplates/qquicktemplatesutils.cpp
new file mode 100644
index 0000000000..e998904cac
--- /dev/null
+++ b/src/quicktemplates/qquicktemplatesutils.cpp
@@ -0,0 +1,35 @@
+// 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
+
+#include "qquicktemplatesutils_p.h"
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquicktextarea_p.h>
+#include <QtQuickTemplates2/private/qquicktextfield_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QQuickTemplatesUtils {
+
+/*!
+ \internal
+
+ Returns \c true if \a item is a \c QQuickControl or similar interactive
+ type that should be a QQuickControl-subclass but cannot due to existing
+ inheritance; e.g. \c QQuickTextField or \c QQuickTextArea.
+
+ \c QQuickPopup is not considered a controls type for this function due to
+ the original use cases that resulted in this being factored out.
+
+ \c QQuickLabel is not interactive.
+*/
+bool isInteractiveControlType(const QQuickItem *item)
+{
+ return qobject_cast<const QQuickControl *>(item)
+ || qobject_cast<const QQuickTextField *>(item)
+ || qobject_cast<const QQuickTextArea *>(item);
+}
+
+} // namespace QQuickTemplatesUtils
+
+QT_END_NAMESPACE