TextEditor
Properties | |
alias | body |
alias | bold |
alias | canRedo |
alias | document |
alias | documentMenu |
alias | fileUrl |
alias | italic |
alias | scrollView |
bool | showFindBar |
bool | showLineNumbers |
bool | spellcheckEnabled |
alias | text |
alias | underline |
alias | uppercase |
Properties inherited from Page | |
bool | altHeader |
bool | autoHideFooter |
int | autoHideFooterDelay |
int | autoHideFooterMargins |
bool | autoHideHeader |
int | autoHideHeaderDelay |
int | autoHideHeaderMargins |
int | bottomMargin |
alias | content |
Flickable | flickable |
bool | floatingFooter |
bool | floatingHeader |
alias | footBar |
Item | footer |
alias | footerColumn |
alias | footerContainer |
int | footerPositioning |
alias | headBar |
Item | header |
int | headerColorSet |
alias | headerColumn |
alias | headerContainer |
int | headerPositioning |
alias | internalHeight |
int | leftMargin |
int | margins |
alias | pageContent |
int | rightMargin |
bool | showTitle |
string | title |
int | topMargin |
Public Member Functions | |
void | forceActiveFocus () |
void | goToLine (line) |
Additional Inherited Members | |
Signals inherited from Page | |
void | goBackTriggered () |
void | goForwardTriggered () |
Detailed Description
Integrated text editor component.
- Since
- org.mauikit.texteditor 1.0
A text area for editing text with convinient functions. The Editor is controlled by the DocumentHandler which controls the files I/O, the syntax highlighting styles, and many more text editing properties.
Features
The TextEditor control comes with a set of built-in features, such as find & replace, syntax highlighting support, line number sidebar, I/O capabilities, file document alerts, and syntax corrector.
I/O
Opening a local text file is handle by the DocumentHandler via the fileUrl
property. The document contents will be loaded by the FileLoader and made available to the TextEditor for drawing.
- See also
- DocumentHandler::fileUrl
- Warning
- Opening large contents will cause the app to freeze, since it is not optimized to dynamically allocate the contents by chunks and instead all of the content will be rendered at once. A solution with a different backend is being implemented.
Once an existing document is opened or created, it will also be watched for any external changes, such as modifications to its contents or its removal, those changes will be notified via the alert bars, exposing the avaliable options.
- See also
- DocumentHandler::autoReload
To save any changes made to an existing document or to save a new one manually use the exposed method DocumentHandler::saveAs, which will take as parameter the location where to save the file at, if you mean to save the changes to an already existing file, simply pass the DocumentHandler::fileUrl value. The changes made could be automatically saved every few seconds if the DocumentHandler::autoSave property is enabled.
Syntax Highlighting
To enable the syntax highlighting enable the DocumentHandler::enableSyntaxHighlighting property.
- Note
- If the language is not detected automatically or if you desire to change it, use the
showSyntaxHighlightingLanguages
property to toggle the selection combobox to allow the user to select a custom language, and bind it to the DocumentHandler::formatName property.
There are different color schemes available, those can be set using the DocumentHandler::theme property. You can also use the ColorSchemesPage control which lists all the available options.
Others
The find & replace bars can be toggled using the showFindBar
property.
- See also
- DocumentHandler::findWholeWords
- DocumentHandler::findCaseSensitively
To enable the line number sidebar use the showLineNumbers
property.
Spell checking can be anbled using the spellcheckEnabled
property. For this Sonnet must be available.
Fonts & Colors
For tweaking the font properties and colors use the DocumentHandler::textColor and DocumentHandler::backgroundColor, etc.
For more details and properties check the own DocumentHandler properties.
Definition at line 76 of file TextEditor.qml.
Property Documentation
◆ body
|
read |
Access to the editor text area.
- Remarks
- This property is read-only
Definition at line 96 of file TextEditor.qml.
◆ bold
|
read |
- See also
- DocumentHandler::bold
Definition at line 139 of file TextEditor.qml.
◆ canRedo
|
read |
Whether there are modifications to the document that can be redo.
Alias to the TextArea::canRedo
Definition at line 144 of file TextEditor.qml.
◆ document
|
read |
Alias to access the DocumentHandler.
- Remarks
- This property is read-only
Definition at line 102 of file TextEditor.qml.
◆ documentMenu
|
read |
Alias to the contextual menu.
- Remarks
- This property is read-only
This menu is loaded asynchronous.
Definition at line 114 of file TextEditor.qml.
◆ fileUrl
|
read |
If a file url is provided the DocumentHandler will try to open its contents and display it.
- See also
- DocumentHandler::fileUrl
Definition at line 150 of file TextEditor.qml.
◆ italic
|
read |
- See also
- DocumentHandler::italic
Definition at line 134 of file TextEditor.qml.
◆ scrollView
|
read |
Alias to the ScrollView.
- Remarks
- This property is read-only
Definition at line 108 of file TextEditor.qml.
◆ showFindBar
|
read |
Definition at line 85 of file TextEditor.qml.
◆ showLineNumbers
|
read |
If a sidebar listing each line number should be visible.
By default this is set to false
Definition at line 155 of file TextEditor.qml.
◆ spellcheckEnabled
|
read |
Whether to enable the spell checker.
By default this is set to false
Definition at line 160 of file TextEditor.qml.
◆ text
|
read |
Alias to the text area text content.
Definition at line 119 of file TextEditor.qml.
◆ underline
|
read |
- See also
- DocumentHandler::underline
Definition at line 129 of file TextEditor.qml.
◆ uppercase
|
read |
- See also
- DocumentHandler::uppercase
Definition at line 124 of file TextEditor.qml.
Member Function Documentation
◆ forceActiveFocus()
void TextEditor::forceActiveFocus | ( | ) |
Force to focus the text area for input.
◆ goToLine()
void TextEditor::goToLine | ( | line | ) |
Position the view and cursor at the given line number.
- Parameters
-
line the line number
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.