File: README.md

package info (click to toggle)
ktexteditor 5.62.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 35,048 kB
  • sloc: cpp: 81,679; xml: 171; sh: 20; makefile: 13
file content (63 lines) | stat: -rw-r--r-- 1,767 bytes parent folder | download | duplicates (3)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# KTextEditor

Full text editor component

## Introduction

KTextEditor provides a powerful text editor component that you can embed in your
application, either as a KPart or using the KF5::TextEditor library (if you need
more control).

The text editor component contains many useful features, from syntax
highlighting and automatic indentation to advanced scripting support, making it
suitable for everything from a simple embedded text-file editor to an advanced
IDE.

## Usage

### KPart

As with other KParts, you should use KParts::MainWindow as your main window.
You can directly request "katepart", as in

    KService::Ptr service = KService::serviceByDesktopPath("katepart");
    if (service) {
        m_part = service->createInstance<KParts::ReadWritePart>(0);
    }

See the KParts documentation for more information on using KParts.

### Library

If you are using CMake, you need to have

    find_package(KF5TextEditor NO_MODULE)

(or similar) in your CMakeLists.txt file, and you need to link to
KF5::TextEditor.

After that, you can use KTextEditor::Editor to create an editor instance, and
use that to manage KTextEditor::Document instances.

    #include <KTextEditor/Document>
    #include <KTextEditor/Editor>
    #include <KTextEditor/View>
    
    KTextEditor::Editor *editor = KTextEditor::Editor::instance();
    // create a new document
    KTextEditor::Document *doc = editor->createDocument(this);
    // create a widget to display the document
    KTextEditor::View *view = doc->createView(containerWidget);

See the documentation for these classes for more information.

## Licensing

Contributions to KTextEditor shall be licensed under LGPLv2+.

## Further Documentation

- @ref kte_design
- @ref kte_port_to_5
- @ref kte_guidelines