KTextEditor
view.h
134 * implementation. The getter viewInputMode() returns enum \InputMode representing the current mode.
137 * \e NormalModeInsert and \e NormalModeOverwrite. You can use viewMode() getter to obtain those.
427 * \warning !!!!!! DON'T USE THIS FUNCTION, UNLESS YOU ARE SURE YOU DON'T WANT PLUGINS TO WORK !!!!!!
800 bool insertTemplate(KTextEditor::Cursor insertPosition, const QString &templateString, const QString &script = QString());
942 virtual void readSessionConfig(const KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) = 0;
952 virtual void writeSessionConfig(KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) = 0;
960 virtual QExplicitlySharedDataPointer<KTextEditor::Attribute> defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle defaultStyle) const = 0;
1033 * \param delegate the new AbstractAnnotationItemDelegate, or \c nullptr to reset to the default delegate
1037 virtual void setAnnotationItemDelegate(KTextEditor::AbstractAnnotationItemDelegate *delegate) = 0;
1055 * @param uniformItemSizes if \c true the annotation items are considered to all have the same size
1224 * \param models list of models to start. If this is an empty list, all registered models are started.
A delegate for rendering line annotation information and handling events.
Definition abstractannotationitemdelegate.h:122
An model for providing line annotation information.
Definition annotationinterface.h:42
An item model for providing code completion, and meta information for enhanced presentation.
Definition codecompletionmodel.h:68
A source of inline notes for a document.
Definition inlinenoteprovider.h:29
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition mainwindow.h:47
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
Class to provide text hints for a View.
Definition texthintinterface.h:42
void horizontalScrollPositionChanged(KTextEditor::View *view)
This signal should be emitted whenever the view is scrolled horizontally.
virtual int textHintDelay() const =0
Get the text hint delay in milliseconds.
virtual void setConfigValue(const QString &key, const QVariant &value)=0
Set a the key's value to value.
void displayRangeChanged(KTextEditor::View *view)
This signal is emitted whenever the displayed range changes.
virtual QMenu * defaultContextMenu(QMenu *menu=nullptr) const =0
Populate menu with default text editor actions.
int lastDisplayedLine(LineType lineType=RealLine) const
Get the last displayed line in the view.
Definition ktexteditor.cpp:403
virtual void setViewInputMode(InputMode inputMode)=0
Set the view's new input mode.
virtual bool isAutomaticInvocationEnabled() const =0
Determine the status of automatic code completion invocation.
int firstDisplayedLine(LineType lineType=RealLine) const
Get the first displayed line in the view.
Definition ktexteditor.cpp:398
virtual bool uniformAnnotationItemSizes() const =0
Checks whether the annotation items all have the same size.
virtual QVariant configValue(const QString &key)=0
Get a value for the key.
virtual bool setCursorPosition(Cursor position)=0
Set the view's new cursor to position.
virtual void forceCompletion()=0
Force execution of the currently selected completion, and hide the code completion box.
void annotationContextMenuAboutToShow(KTextEditor::View *view, QMenu *menu, int line)
This signal is emitted before a context menu is shown on the annotation border for the given line and...
void configChanged(KTextEditor::View *view)
This signal is emitted whenever the current view configuration is changed.
virtual InputMode viewInputMode() const =0
Get the view's current input mode.
void textInserted(KTextEditor::View *view, KTextEditor::Cursor position, const QString &text)
This signal is emitted from view whenever the users inserts text at position, that means the user typ...
virtual bool setMouseTrackingEnabled(bool enable)=0
Try to enable or disable mouse tracking according to enable.
void statusBarEnabledChanged(KTextEditor::View *view, bool enabled)
This signal is emitted whenever the status bar of view is toggled.
void viewInputModeChanged(KTextEditor::View *view, KTextEditor::View::InputMode mode)
This signal is emitted whenever the view's input mode changes.
virtual void registerInlineNoteProvider(KTextEditor::InlineNoteProvider *provider)=0
Inline Note.
virtual Document * document() const =0
Get the view's document, that means the view is a view of the returned document.
virtual void startCompletion(const Range &word, const QList< CodeCompletionModel * > &models=QList< CodeCompletionModel * >(), KTextEditor::CodeCompletionModel::InvocationType invocationType=KTextEditor::CodeCompletionModel::ManualInvocation)=0
Invoke code completion over a given range, with specific models and invocation type.
virtual bool removeSelectionText()=0
Remove the view's current selection including the selected text.
ViewMode
Possible view modes These correspond to various modes the text editor might be in.
Definition view.h:295
virtual bool blockSelection() const =0
Get the status of the selection mode.
virtual QScrollBar * horizontalScrollBar() const =0
KSyntaxHighlighting::Theme theme() const
Get the current active theme of this view.
Definition ktexteditor.cpp:179
void setScrollPosition(KTextEditor::Cursor cursor)
Scroll view to cursor.
Definition ktexteditor.cpp:383
virtual QPoint cursorPositionCoordinates() const =0
Get the screen coordinates (x, y) of the cursor position in pixels.
virtual QScrollBar * verticalScrollBar() const =0
virtual void setAnnotationItemDelegate(KTextEditor::AbstractAnnotationItemDelegate *delegate)=0
Sets the AbstractAnnotationItemDelegate for this view and the model to provide custom rendering of an...
void setHorizontalScrollPosition(int x)
Horizontally scroll view to position.
Definition ktexteditor.cpp:388
virtual QList< CodeCompletionModel * > codeCompletionModels() const =0
Obtain the list of registered code completion models.
virtual AnnotationModel * annotationModel() const =0
returns the currently set AnnotationModel or 0 if there's none set
void setSelections(const QList< KTextEditor::Range > &ranges)
Set the view's selection to the range selection.
Definition ktexteditor.cpp:194
void focusOut(KTextEditor::View *view)
This signal is emitted whenever the view loses the focus.
virtual Cursor cursorPosition() const =0
Get the view's current cursor position.
void annotationActivated(KTextEditor::View *view, int line)
This signal is emitted when an entry on the annotation border was activated, for example by clicking ...
virtual QString viewInputModeHuman() const =0
Get the view's current input mode in human readable form.
QRect textAreaRect() const
Get the view's text area rectangle excluding border, scrollbars, etc.
Definition ktexteditor.cpp:408
void focusIn(KTextEditor::View *view)
This signal is emitted whenever the view gets the focus.
virtual void readSessionConfig(const KConfigGroup &config, const QSet< QString > &flags=QSet< QString >())=0
Read session settings from the given config.
virtual void registerTextHintProvider(KTextEditor::TextHintProvider *provider)=0
Text Hint.
virtual QMenu * contextMenu() const =0
Get the context menu for this view.
virtual bool isAnnotationBorderVisible() const =0
Checks whether the View's annotation border is visible.
virtual void setAnnotationModel(AnnotationModel *model)=0
View Annotation Interface.
virtual bool insertText(const QString &text)
This is a convenience function which inserts text at the view's current cursor position.
Definition ktexteditor.cpp:148
virtual QString viewModeHuman() const =0
Get the current view mode state.
virtual void writeSessionConfig(KConfigGroup &config, const QSet< QString > &flags=QSet< QString >())=0
Write session settings to the config.
virtual void setAnnotationUniformItemSizes(bool uniformItemSizes)=0
This function can be used to declare whether it is known that the annotation items rendered by the se...
virtual bool mouseTrackingEnabled() const =0
Check, whether mouse tracking is enabled.
virtual void setAutomaticInvocationEnabled(bool enabled=true)=0
Enable or disable automatic code completion invocation.
virtual void abortCompletion()=0
Abort the currently displayed code completion without executing any currently selected completion.
virtual KTextEditor::Cursor coordinatesToCursor(const QPoint &coord) const =0
Get the text-cursor in the document from the screen coordinates, relative to the view widget.
virtual QList< KTextEditor::AttributeBlock > lineAttributes(int line)=0
Get the list of AttributeBlocks for a given line in the document.
void cursorPositionChanged(KTextEditor::View *view, KTextEditor::Cursor newPosition)
This signal is emitted whenever the view's cursor position changed.
bool insertTemplate(KTextEditor::Cursor insertPosition, const QString &templateString, const QString &script=QString())
Insert a template into the document.
Definition ktexteditor.cpp:174
virtual bool setSelection(Range range)=0
Set the view's selection to the range selection.
virtual void setContextMenu(QMenu *menu)=0
Set a context menu for this view to menu.
void setCursorPositions(const QList< KTextEditor::Cursor > &positions)
Set the view's new cursors to positions.
Definition ktexteditor.cpp:184
virtual bool selection() const =0
Query the view whether it has selected text, i.e.
virtual Cursor cursorPositionVirtual() const =0
Get the current virtual cursor position, virtual means the tabulator character (TAB) counts multiple ...
virtual QExplicitlySharedDataPointer< KTextEditor::Attribute > defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle defaultStyle) const =0
Returns the attribute for the default style defaultStyle.
virtual void unregisterInlineNoteProvider(KTextEditor::InlineNoteProvider *provider)=0
Unregister the inline note provider provider.
virtual Range selectionRange() const =0
Get the range occupied by the current selection.
QList< KTextEditor::Range > selectionRanges() const
Get the ranges occupied by the current selections.
Definition ktexteditor.cpp:199
virtual void setAnnotationBorderVisible(bool visible)=0
This function can be used to show or hide the annotation border The annotation border is hidden by de...
void mousePositionChanged(KTextEditor::View *view, KTextEditor::Cursor newPosition)
This signal is emitted whenever the position of the mouse changes over this view.
virtual KTextEditor::AbstractAnnotationItemDelegate * annotationItemDelegate() const =0
Returns the currently used AbstractAnnotationItemDelegate.
virtual void registerCompletionModel(CodeCompletionModel *model)=0
Register a new code completion model.
void viewModeChanged(KTextEditor::View *view, KTextEditor::View::ViewMode mode)
This signal is emitted whenever the view mode of view changes.
virtual void setTextHintDelay(int delay)=0
Set the text hint delay to delay milliseconds.
void selectionChanged(KTextEditor::View *view)
This signal is emitted whenever the view's selection changes.
void annotationBorderVisibilityChanged(KTextEditor::View *view, bool visible)
This signal is emitted when the annotation border is shown or hidden.
virtual QPoint cursorToCoordinate(KTextEditor::Cursor cursor) const =0
Get the screen coordinates (x, y) of the supplied cursor relative to the view widget in pixels.
virtual bool setBlockSelection(bool on)=0
Set block selection mode to state on.
void contextMenuAboutToShow(KTextEditor::View *view, QMenu *menu)
Signal which is emitted immediately prior to showing the current context menu.
virtual bool removeSelection()=0
Remove the view's current selection, without deleting the selected text.
virtual void unregisterTextHintProvider(KTextEditor::TextHintProvider *provider)=0
Unregister the text hint provider provider.
virtual void unregisterCompletionModel(CodeCompletionModel *model)=0
Unregister a code completion model.
virtual KTextEditor::MainWindow * mainWindow() const =0
Get the view's main window, if any.
virtual QString selectionText() const =0
Get the view's selected text.
QList< KTextEditor::Cursor > cursorPositions() const
Get the view's current cursor positions.
Definition ktexteditor.cpp:189
virtual void startCompletion(Range word, CodeCompletionModel *model)=0
Invoke code completion over a given range, with a specific model.
KTextEditor::Cursor maxScrollPosition() const
Get the cursor corresponding to the maximum position the view can vertically scroll to.
Definition ktexteditor.cpp:393
void verticalScrollPositionChanged(KTextEditor::View *view, KTextEditor::Cursor newPos)
This signal should be emitted whenever the view is scrolled vertically.
void setStatusBarEnabled(bool enable)
Show/hide the status bar of the view.
Definition ktexteditor.cpp:163
KXMLGUIClient()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
cursor
enabled
visible
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.