• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

LICENSES/H03-May-2022-

autotests/H03-May-2022-31,12322,853

cmake/H04-Dec-2021-4540

docs/H04-Dec-2021-466384

po/H04-Dec-2021-660,967557,675

src/H03-May-2022-111,20072,706

templates/H03-May-2022-276189

.git-blame-ignore-revsH A D04-Dec-2021389 1110

.gitignoreH A D04-Dec-2021311 2928

.gitlab-ci.ymlH A D04-Dec-2021284 75

.kateconfigH A D04-Dec-202159 21

.kateprojectH A D04-Dec-202179 64

.kde-ci.ymlH A D04-Dec-2021525 1816

ExtraDesktop.shH A D04-Dec-2021178 51

KF5TextEditorConfig.cmake.inH A D04-Dec-2021258 107

README.mdH A D04-Dec-20212 KiB8054

config.h.cmakeH A D04-Dec-2021186 116

metainfo.yamlH A D04-Dec-2021365 2119

README.md

1# KTextEditor
2
3Full text editor component
4
5## Introduction
6
7KTextEditor provides a powerful text editor component that you can embed in your
8application, either as a KPart or using the KF5::TextEditor library (if you need
9more control).
10
11The text editor component contains many useful features, from syntax
12highlighting and automatic indentation to advanced scripting support, making it
13suitable for everything from a simple embedded text-file editor to an advanced
14IDE.
15
16## Usage
17
18### KPart
19
20As with other KParts, you should use KParts::MainWindow as your main window.
21You can directly request "katepart", as in
22
23```cpp
24KService::Ptr service = KService::serviceByDesktopName("katepart");
25if (service) {
26    m_part = service->createInstance<KParts::ReadWritePart>();
27}
28```
29
30See the KParts documentation for more information on using KParts.
31
32### Library
33
34If you are using CMake, you need to have
35
36```cmake
37find_package(KF5TextEditor)
38```
39
40(or similar) in your CMakeLists.txt file, and you need to link to
41KF5::TextEditor.
42
43After that, you can use KTextEditor::Editor to create an editor instance, and
44use that to manage KTextEditor::Document instances.
45
46```cpp
47#include <KTextEditor/Document>
48#include <KTextEditor/Editor>
49#include <KTextEditor/View>
50
51KTextEditor::Editor *editor = KTextEditor::Editor::instance();
52// create a new document
53KTextEditor::Document *doc = editor->createDocument(this);
54// create a widget to display the document
55KTextEditor::View *view = doc->createView(containerWidget);
56```
57
58See the documentation for these classes for more information.
59
60## Licensing
61
62Contributions to KTextEditor shall be licensed under [LGPLv2+](LICENSES/LGPL-2.0-or-later.txt).
63
64All files shall contain a proper "SPDX-License-Identifier: LGPL-2.0-or-later" identifier inside a header like:
65
66```cpp
67/*
68    SPDX-FileCopyrightText: 2021 Christoph Cullmann <cullmann@kde.org>
69
70    SPDX-License-Identifier: LGPL-2.0-or-later
71*/
72```
73
74## Further Documentation
75
76- @ref kte_design
77- @ref kte_port_to_5
78- @ref kte_guidelines
79
80