aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/accessible/qaccessiblequicktextinput.cpp
blob: 23132e0cedc2e11d8f658bc6b61de0a71332d5b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2025 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 "qaccessiblequicktextinput_p.h"

QT_BEGIN_NAMESPACE

#if QT_CONFIG(accessibility)

QAccessibleQuickTextInput::QAccessibleQuickTextInput(QQuickTextInput *textEdit)
    : QAccessibleQuickItem(textEdit)
{
}

void QAccessibleQuickTextInput::removeSelection(int selectionIndex)
{
    if (selectionCount() == 1 && selectionIndex == 0) {
        const int cursorPos = textInput()->cursorPosition();
        textInput()->select(cursorPos, cursorPos);
    }
}

void QAccessibleQuickTextInput::setSelection(int selectionIndex, int startOffset, int endOffset)
{
    if (selectionIndex == 0)
        textInput()->select(startOffset, endOffset);
}

#endif // accessibility

QT_END_NAMESPACE