/src/qtbase/src/gui/kernel/qaccessibilityhints.cpp
Line | Count | Source |
1 | | // Copyright (C) 2025 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 | | |
5 | | #include "qaccessibilityhints.h" |
6 | | #include "qaccessibilityhints_p.h" |
7 | | |
8 | | QT_BEGIN_NAMESPACE |
9 | | |
10 | | void QAccessibilityHintsPrivate::updateContrastPreference(Qt::ContrastPreference contrastPreference) |
11 | 93.9k | { |
12 | 93.9k | if (m_contrastPreference == contrastPreference) |
13 | 93.9k | return; |
14 | 0 | m_contrastPreference = contrastPreference; |
15 | |
|
16 | 0 | Q_Q(QAccessibilityHints); |
17 | 0 | emit q->contrastPreferenceChanged(contrastPreference); |
18 | 0 | } |
19 | | |
20 | | void QAccessibilityHintsPrivate::updateMotionPreference(Qt::MotionPreference motionPreference) |
21 | 93.9k | { |
22 | 93.9k | if (m_motionPreference == motionPreference) |
23 | 93.9k | return; |
24 | 0 | m_motionPreference = motionPreference; |
25 | |
|
26 | 0 | Q_Q(QAccessibilityHints); |
27 | 0 | emit q->motionPreferenceChanged(motionPreference); |
28 | 0 | } |
29 | | |
30 | | QAccessibilityHintsPrivate *QAccessibilityHintsPrivate::get(QAccessibilityHints *q) |
31 | 93.9k | { |
32 | 93.9k | Q_ASSERT(q); |
33 | 93.9k | return q->d_func(); |
34 | 93.9k | } |
35 | | |
36 | | /*! |
37 | | \class QAccessibilityHints |
38 | | \since 6.10 |
39 | | \brief The QAccessibilityHints class contains platform specific accessibility hints and settings. |
40 | | \inmodule QtGui |
41 | | |
42 | | This class bundles together platform specific accessibility settings, and can be accessed from |
43 | | \l QStyleHints::accessibility. |
44 | | |
45 | | \sa QStyleHints |
46 | | */ |
47 | | |
48 | | QAccessibilityHints::QAccessibilityHints(QObject *parent) |
49 | 93.9k | : QObject(*(new QAccessibilityHintsPrivate), parent) |
50 | 93.9k | {} |
51 | | |
52 | 93.9k | QAccessibilityHints::~QAccessibilityHints() = default; |
53 | | |
54 | | /*! |
55 | | \property QAccessibilityHints::contrastPreference |
56 | | \brief The contrast mode set by the system. |
57 | | |
58 | | This property can be used by the application to determine what contrast settings the system |
59 | | is currently using. |
60 | | |
61 | | Qt styles use this property in order to adjust palette colors and outlines. |
62 | | |
63 | | \sa Qt::ColorScheme, QGuiApplication::palette(), QEvent::PaletteChange |
64 | | \since 6.10 |
65 | | */ |
66 | | Qt::ContrastPreference QAccessibilityHints::contrastPreference() const |
67 | 0 | { |
68 | 0 | Q_D(const QAccessibilityHints); |
69 | 0 | return d->m_contrastPreference; |
70 | 0 | } |
71 | | |
72 | | /*! |
73 | | \property QAccessibilityHints::motionPreference |
74 | | \brief The motion preference set by the system. |
75 | | |
76 | | This property can be used by the application to determine if the user interface should have |
77 | | fewer animated effects. Respecting this preference may make the application more accessible |
78 | | to those that suffer from vestibular motion disorders. |
79 | | |
80 | | \sa contrastPreference |
81 | | \since 6.12 |
82 | | */ |
83 | | Qt::MotionPreference QAccessibilityHints::motionPreference() const |
84 | 0 | { |
85 | 0 | Q_D(const QAccessibilityHints); |
86 | 0 | return d->m_motionPreference; |
87 | 0 | } |
88 | | |
89 | | /*! |
90 | | \reimp |
91 | | */ |
92 | | bool QAccessibilityHints::event(QEvent *event) |
93 | 0 | { |
94 | 0 | return QObject::event(event); |
95 | 0 | } |
96 | | |
97 | | QT_END_NAMESPACE |
98 | | |
99 | | #include "moc_qaccessibilityhints.cpp" |