Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktemplatesutils.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
7#include <QtQuickTemplates2/private/qquickcontrol_p.h>
8#include <QtQuickTemplates2/private/qquicktextarea_p.h>
9#include <QtQuickTemplates2/private/qquicktextfield_p.h>
10
11#include <QtCore/qloggingcategory.h>
12
14
15Q_STATIC_LOGGING_CATEGORY(lcTextFormat, "qt.quick.controls.textformat")
16
17namespace QQuickTemplatesUtils {
18
19/*!
20 \internal
21
22 Returns \c true if \a item is a \c QQuickControl or similar interactive
23 type that should be a QQuickControl-subclass but cannot due to existing
24 inheritance; e.g. \c QQuickTextField or \c QQuickTextArea.
25
26 \c QQuickPopup is not considered a controls type for this function due to
27 the original use cases that resulted in this being factored out.
28
29 \c QQuickLabel is not interactive.
30*/
31bool isInteractiveControlType(const QQuickItem *item)
32{
33 return qobject_cast<const QQuickControl *>(item)
34 || qobject_cast<const QQuickTextField *>(item)
35 || qobject_cast<const QQuickTextArea *>(item);
36}
37
38// This is used temporarily as preparation for changing the default text format. It will be
39// removed once it is no longer needed.
40void warnAboutImplicitRichText(const QObject *object)
41{
42 qCWarning(lcTextFormat)
43 << "Rich text support has implicitly been enabled on a component with "
44 "the default text format of AutoText. Unexpected rich text support may have "
45 "security implications. Therefore, the default text format will change to PlainText "
46 "in a future version of Qt. Please explicitly choose the appropriate text format in "
47 "your components to avoid errors in a future upgrade. Affected component:" << object;
48}
49
50} // namespace QQuickTemplatesUtils
51
52QT_END_NAMESPACE
Q_QUICKTEMPLATES2_EXPORT void warnAboutImplicitRichText(const QObject *object)
bool isInteractiveControlType(const QQuickItem *item)
Combined button and popup list for selecting options.