edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
accessibletexteditorwidget.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QAccessibleTextInterface>
9#include <QAccessibleWidget>
10#include <QAccessibleTextInterface>
11#include <QAccessibleEditableTextInterface>
12
13
14namespace edbee {
15
17class TextDocument;
20class TextRenderer;
21class TextSelection;
22
23class EDBEE_EXPORT AccessibleTextEditorWidget : public QAccessibleWidget, public QAccessibleTextInterface
24{
25public:
28
29
30public:
31 static QAccessibleInterface* factory(const QString& className, QObject * object);
32 static QWidget* eventWidgetForTextEditor(TextEditorWidget* widget);
33
35 static void notifyTextChangeEvent(TextEditorWidget* widget, TextBufferChange* change, QString oldText);
36
37
38 void* interface_cast(QAccessible::InterfaceType t) override;
39 QAccessible::State state() const override;
40
41 // QAccessibleTextInterface interface
42public:
43 virtual void selection(int selectionIndex, int *startOffset, int *endOffset) const override;
44 virtual int selectionCount() const override;
45 virtual void addSelection(int startOffset, int endOffset) override;
46 virtual void removeSelection(int selectionIndex) override;
47 virtual void setSelection(int selectionIndex, int startOffset, int endOffset) override;
48 virtual int cursorPosition() const override;
49 virtual void setCursorPosition(int position) override;
50 virtual QString text(QAccessible::Text t) const override;
51 virtual QString text(int startOffset, int endOffset) const override;
52 virtual int characterCount() const override;
53 virtual QRect characterRect(int offset) const override;
54 virtual int offsetAtPoint(const QPoint &point) const override;
55 virtual void scrollToSubstring(int startIndex, int endIndex) override;
56 virtual QString attributes(int offset, int *startOffset, int *endOffset) const override;
57
58 virtual QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override;
59 virtual QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override;
60 virtual QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override;
61
62 virtual QAccessibleInterface* focusChild() const override;
63 virtual QRect rect() const override;
64
65protected:
66
70 TextRenderer* renderer() const;
72
73private:
74 TextEditorWidget* textWidgetRef_;
75};
76
77} // Edbee
virtual void setSelection(int selectionIndex, int startOffset, int endOffset) override
Set the selection selectionIndex to the range from startOffset to endOffset.
Definition accessibletexteditorwidget.cpp:308
virtual void removeSelection(int selectionIndex) override
Clears the selection with index selectionIndex.
Definition accessibletexteditorwidget.cpp:300
TextRenderer * renderer() const
Definition accessibletexteditorwidget.cpp:551
virtual QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
Returns the text item of type boundaryType at offset offset and sets startOffset and endOffset values...
Definition accessibletexteditorwidget.cpp:469
virtual QString text(QAccessible::Text t) const override
Definition accessibletexteditorwidget.cpp:329
static QWidget * eventWidgetForTextEditor(TextEditorWidget *widget)
Returns the widget that should be used for accessibility events.
Definition accessibletexteditorwidget.cpp:180
virtual QRect characterRect(int offset) const override
Returns the position and size of the character at position offset in screen coordinates.
Definition accessibletexteditorwidget.cpp:359
virtual QRect rect() const override
Returns the rectangle for the editor widget It returns the location of the textWidget (even when the ...
Definition accessibletexteditorwidget.cpp:529
virtual void setCursorPosition(int position) override
Move the cursor position.
Definition accessibletexteditorwidget.cpp:323
virtual void selection(int selectionIndex, int *startOffset, int *endOffset) const override
Returns a selection. The size of the selection is returned in startOffset and endOffset....
Definition accessibletexteditorwidget.cpp:265
virtual QAccessibleInterface * focusChild() const override
Definition accessibletexteditorwidget.cpp:521
virtual QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
Returns the text item of type boundaryType that is right after offset offset and sets startOffset and...
Definition accessibletexteditorwidget.cpp:430
static QAccessibleInterface * factory(const QString &className, QObject *object)
Construct the AccessibleTextEditor interface for the given widget.
Definition accessibletexteditorwidget.cpp:162
virtual QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
Returns the text item of type boundaryType that is close to offset offset and sets startOffset and en...
Definition accessibletexteditorwidget.cpp:515
void * interface_cast(QAccessible::InterfaceType t) override
Definition accessibletexteditorwidget.cpp:237
virtual void scrollToSubstring(int startIndex, int endIndex) override
Ensures that the text between startIndex and endIndex is visible.
Definition accessibletexteditorwidget.cpp:399
static void notifyTextChangeEvent(TextEditorWidget *widget, TextBufferChange *change, QString oldText)
Notifies a text change event happens.
Definition accessibletexteditorwidget.cpp:215
virtual int selectionCount() const override
Returns the number of selections in this text.
Definition accessibletexteditorwidget.cpp:279
AccessibleTextEditorWidget(TextEditorWidget *widget)
Definition accessibletexteditorwidget.cpp:147
static void notifyTextSelectionEvent(TextEditorWidget *widget, TextSelection *selection)
Notifies a text-selection change event.
Definition accessibletexteditorwidget.cpp:190
virtual int offsetAtPoint(const QPoint &point) const override
Returns the offset of the character at the point in screen coordinates.
Definition accessibletexteditorwidget.cpp:389
virtual int cursorPosition() const override
Returns the current cursor position.
Definition accessibletexteditorwidget.cpp:316
virtual QString attributes(int offset, int *startOffset, int *endOffset) const override
Returns the text attributes at the position offset. In addition the range of the attributes is return...
Definition accessibletexteditorwidget.cpp:409
TextEditorWidget * textWidget() const
Definition accessibletexteditorwidget.cpp:556
TextEditorController * controller() const
Definition accessibletexteditorwidget.cpp:546
virtual void addSelection(int startOffset, int endOffset) override
Select the text from startOffset to endOffset. The startOffset is the first character that will be se...
Definition accessibletexteditorwidget.cpp:292
TextDocument * textDocument() const
Definition accessibletexteditorwidget.cpp:536
TextSelection * textSelection() const
Definition accessibletexteditorwidget.cpp:541
virtual int characterCount() const override
Returns the length of the text (total size including spaces).
Definition accessibletexteditorwidget.cpp:351
QAccessible::State state() const override
Definition accessibletexteditorwidget.cpp:246
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition textbuffer.h:45
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition textdocument.h:42
The texteditor works via the controller. The controller is the central point/mediator which maps/cont...
Definition texteditorcontroller.h:39
This is the general edbee widget The core functionality of this widget is divided in several separate...
Definition texteditorwidget.h:36
A class for rendering the text.
Definition textrenderer.h:35
The class textselection is a RangeSet that is used by the view of the document.
Definition textselection.h:25
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20