Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qaccessiblequicktextinput.cpp
Go to the documentation of this file.
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
"qaccessiblequicktextinput_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
#
if
QT_CONFIG
(
accessibility
)
10
11
QAccessibleQuickTextInput::QAccessibleQuickTextInput(QQuickTextInput *textEdit)
12
: QAccessibleQuickItem(textEdit)
13
{
14
}
15
16
void
QAccessibleQuickTextInput::removeSelection(
int
selectionIndex)
17
{
18
if
(selectionCount() == 1 && selectionIndex == 0) {
19
const
int
cursorPos = textInput()->cursorPosition();
20
textInput()->select(cursorPos, cursorPos);
21
}
22
}
23
24
void
QAccessibleQuickTextInput::setSelection(
int
selectionIndex,
int
startOffset,
int
endOffset)
25
{
26
if
(selectionIndex == 0)
27
textInput()->select(startOffset, endOffset);
28
}
29
30
void
*QAccessibleQuickTextInput::interface_cast(QAccessible::InterfaceType type)
31
{
32
// Expose EditableTextInterface based on actual text input's editability.
33
// Base class QAccessibleQuickItem::interface_cast() handles TextInterface
34
// automatically for role() == EditableText|StaticText|Heading.
35
if
((type == QAccessible::EditableTextInterface) && !textInput()->isReadOnly())
36
return
static_cast
<QAccessibleEditableTextInterface*>(
this
);
37
return
QAccessibleQuickItem::interface_cast(type);
38
}
39
40
void
QAccessibleQuickTextInput::deleteText(
int
startOffset,
int
endOffset)
41
{
42
textInput()->remove(startOffset, endOffset);
43
}
44
45
void
QAccessibleQuickTextInput::insertText(
int
offset,
const
QString &text)
46
{
47
textInput()->insert(offset, text);
48
}
49
50
void
QAccessibleQuickTextInput::replaceText(
int
startOffset,
int
endOffset,
const
QString &text)
51
{
52
textInput()->remove(startOffset, endOffset);
53
textInput()->insert(startOffset, text);
54
}
55
56
#
endif
// accessibility
57
58
QT_END_NAMESPACE
qtdeclarative
src
quick
accessible
qaccessiblequicktextinput.cpp
Generated on
for Qt by
1.18.0