1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquicktemplatesutils_p.h"
5
6#include <QtQuickTemplates2/private/qquickcontrol_p.h>
7#include <QtQuickTemplates2/private/qquicktextarea_p.h>
8#include <QtQuickTemplates2/private/qquicktextfield_p.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace QQuickTemplatesUtils {
13
14/*!
15 \internal
16
17 Returns \c true if \a item is a \c QQuickControl or similar interactive
18 type that should be a QQuickControl-subclass but cannot due to existing
19 inheritance; e.g. \c QQuickTextField or \c QQuickTextArea.
20
21 \c QQuickPopup is not considered a controls type for this function due to
22 the original use cases that resulted in this being factored out.
23
24 \c QQuickLabel is not interactive.
25*/
26bool isInteractiveControlType(const QQuickItem *item)
27{
28 return qobject_cast<const QQuickControl *>(object: item)
29 || qobject_cast<const QQuickTextField *>(object: item)
30 || qobject_cast<const QQuickTextArea *>(object: item);
31}
32
33} // namespace QQuickTemplatesUtils
34
35QT_END_NAMESPACE
36

source code of qtdeclarative/src/quicktemplates/qquicktemplatesutils.cpp