edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
texteditorcomponent.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
9
10#include <QSize>
11#include <QWidget>
12
13namespace edbee {
14
15class TextRange;
16class TextDocument;
22class TextRenderer;
23class TextSelection;
24
25
28class EDBEE_EXPORT TextEditorComponent : public QWidget
29{
30 Q_OBJECT
31public:
32 explicit TextEditorComponent( TextEditorController* controller, QWidget *parent = 0);
33 virtual ~TextEditorComponent();
34
36 TextEditorConfig* config() const;
41
42 TextEditorRenderer* textEditorRenderer() { return textEditorRenderer_; }
43 void giveTextEditorRenderer( TextEditorRenderer* renderer );
44
45 void resetCaretTime();
46 void fullUpdate();
47
48 virtual QSize sizeHint() const;
49
50protected:
51 virtual void paintEvent( QPaintEvent* paintEvent );
52 virtual void moveEvent( QMoveEvent* moveEvent );
53 virtual void hideEvent( QHideEvent* hideEvent );
54 virtual bool event( QEvent* event );
55 virtual void keyPressEvent( QKeyEvent* event );
56 virtual void keyReleaseEvent ( QKeyEvent* event );
57 void inputMethodEvent( QInputMethodEvent* m );
58 QVariant inputMethodQuery( Qt::InputMethodQuery p ) const;
59 void registerClickEvent();
60 virtual void mousePressEvent( QMouseEvent* event );
61 virtual void mouseReleaseEvent( QMouseEvent* event );
62 virtual void mouseDoubleClickEvent( QMouseEvent* event );
63 virtual void mouseMoveEvent( QMouseEvent* event );
64 virtual void focusInEvent( QFocusEvent* event );
65 virtual void focusOutEvent( QFocusEvent* event );
66 virtual void contextMenuEvent(QContextMenuEvent* event);
67
68public slots:
69
70 void repaintCarets();
71 virtual void updateLineAtOffset(int offset);
72 virtual void updateAreaAroundOffset(int offset, int width=8);
73 virtual void updateLine( int line, int length );
74
75signals:
76 void textKeyPressed();
77
78
79private:
80
81 TextRenderer* textRenderer() const;
82
83 QTimer* caretTimer_;
84
85 QKeySequence lastKeySequence_;
86 QString lastCharacter_;
87
88 TextEditorController* controllerRef_;
89 TextEditorRenderer* textEditorRenderer_;
90
91 int clickCount_;
92 TextRange clickRange_;
93 qint64 lastClickEvent_;
94};
95
96} // edbee
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition textdocument.h:42
This is a texteditor map. This is used to map Command-Names to commands This class is the owner of th...
Definition texteditorcommandmap.h:20
TextSelection * textSelection()
Returns the texselection range.
Definition texteditorcomponent.cpp:128
TextEditorRenderer * textEditorRenderer()
Definition texteditorcomponent.h:42
TextEditorController * controller()
Returns the active texteditor controller.
Definition texteditorcomponent.cpp:121
TextEditorKeyMap * keyMap()
Returns the current keymap.
Definition texteditorcomponent.cpp:114
TextDocument * textDocument() const
Returns the active textdocument.
Definition texteditorcomponent.cpp:107
TextEditorConfig * config() const
Returns the active configuration.
Definition texteditorcomponent.cpp:100
TextEditorComponent(TextEditorController *controller, QWidget *parent=0)
The default texteditor compenent constructor.
Definition texteditorcomponent.cpp:40
TextEditorCommandMap * commandMap()
Returns the active commandmap.
Definition texteditorcomponent.cpp:93
General configuration settings of the text editor.
Definition texteditorconfig.h:18
The texteditor works via the controller. The controller is the central point/mediator which maps/cont...
Definition texteditorcontroller.h:39
A text editor key map This key map, maps key-sequences to action-names.
Definition texteditorkeymap.h:39
Definition texteditorrenderer.h:17
A single text region A region constists of an anchor and a caret: The anchor defines the 'start' of t...
Definition textrange.h:29
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