KTextEditor

Porting to KDE Frameworks 5

Overview | Design | Coding Guidelines | Porting to KDE Frameworks 5

This document describes porting applications using the KTextEditor interfaces from KDE 4 to KDE Frameworks 5. This page does not try to be complete; its main goal is to show what interfaces were removed, changed or added to give some impression and orientation of what you have to do to port your application to the KDE Frameworks 5 KTextEditor interfaces.

Introduction

The KTextEditor interfaces changes in KDE Frameworks 5 are neither binary nor source compatible to the KTextEditor interfaces included in KDE 4, so programs written/compiled for the KDE 4 KTextEditor interfaces will not compile (nor run) under Frameworks 5.

The Frameworks 5 KTextEditor interfaces undergone a heavy cleanup, i.e. obsolete functions were removed, interfaces were merged and extended. All interface changes like for example parameter changes of a function are not mentioned in detail in this page, look into the particular class API documentation.

Removed/Merged Interfaces and Classes

Entirely removed interfaces and classes are:

Interface Changes

The following interfaces were changed:

New Interfaces

The following interfaces are new:

  • KTextEditor::Application (since KDE 5.0)
    The Application is an interface that is implemented by the host application. It provides information about the documents managed by the application as well as convenience functions for instance to open or close documents.
  • KTextEditor::MainWindow (since KDE 5.0)
    A MainWindow usually represents a toplevel window of the application. It manages the views and also provides an accessor to the MainWindow's active view through MainWindow::activeView(). The provides signals that indicate that the active view has changed, or that a view has been created. Other than that, it for instance allows to create tool views and similar convenience functions to show view bars.
  • KTextEditor::Message (since KDE 4.11)
    Class providing notifications to the user in a KTextEditor::View.

Significantly Enhanced Classes

The following classes have been significantly enhanced:

  • KTextEditor::Cursor
    The Cursor now is a tuple of two ints, namely the line and column. It has no virtual destructor so that you cannot derive from Cursor. Since a Cursor uses 8 Bytes, it is even ok to pass a Cursor as copy in parameters instead of a reference. Further, the Cursor has been marked as Q_MOVABLE, making it behave like a Plain Old Data (POD) type.
  • KTextEditor::Range
    The Range now is a tuple of two Cursors, namely the Range::startCursor() and the Range::endCursor(). It has no virtual destructor so that you cannot derive from Range. Further, the Range has been marked as Q_MOVABLE, making it behave like a Plain Old Data (POD) type.
  • KTextEditor::TextHintInterface
    This interface now requires you to call registerTextHintProvider() and unregisterTextHintProvider() with a corresponding object that implements KTextEditor::TextHintProvider.
  • KTextEditor::Attribute
    This class was extended by several attributes that were internal to Kate Part before, including the name, spell checking, and the default style.

New Classes

The following classes are either new, or were added late in the KDE 4 release cycle:

Plugin Architecture Changes

The KTextEditor::Plugin system was heavily extended to support 'application plugins'. That is, a plugin can now create tool views in a KTextEditor::MainWindows and access the Application's document list. So the plugins are now shared between all applications using the KTextEditor interfaces (e.g. Kate, KDevelop, and Kile).

See also
KTextEditor::Plugin
Author
Dominik Haumann <dhaum.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg>
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.