Files
qt-creator/src/plugins/texteditor/texteditor.h

688 lines
23 KiB
C
Raw Normal View History

/****************************************************************************
2008-12-02 12:01:29 +01:00
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
2008-12-02 12:01:29 +01:00
**
** This file is part of Qt Creator.
2008-12-02 12:01:29 +01:00
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
2010-12-17 16:01:08 +01:00
**
****************************************************************************/
2008-12-02 16:19:05 +01:00
#pragma once
2008-12-02 12:01:29 +01:00
#include "texteditor_global.h"
#include "blockrange.h"
#include "codeassist/assistenums.h"
#include "indenter.h"
#include "refactoroverlay.h"
2008-12-02 12:01:29 +01:00
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/helpitem.h>
#include <utils/elidinglabel.h>
#include <utils/link.h>
#include <utils/uncommentselection.h>
#include <QPlainTextEdit>
#include <QSharedPointer>
#include <functional>
2008-12-02 12:01:29 +01:00
QT_BEGIN_NAMESPACE
class QToolBar;
class QPrinter;
class QMenu;
class QPainter;
class QPoint;
class QRect;
class QTextBlock;
2008-12-02 12:01:29 +01:00
QT_END_NAMESPACE
namespace Core {
class HighlightScrollBarController;
}
2008-12-02 12:01:29 +01:00
namespace TextEditor {
class TextDocument;
class TextMark;
class BaseHoverHandler;
class RefactorOverlay;
class SyntaxHighlighter;
class AssistInterface;
class IAssistProvider;
class ICodeStylePreferences;
class CompletionAssistProvider;
using RefactorMarkers = QList<RefactorMarker>;
using TextMarks = QList<TextMark *>;
2008-12-02 12:01:29 +01:00
namespace Internal {
class BaseTextEditorPrivate;
class TextEditorFactoryPrivate;
class TextEditorWidgetPrivate;
class TextEditorOverlay;
2008-12-02 12:01:29 +01:00
}
class AutoCompleter;
class BaseTextEditor;
class TextEditorFactory;
class TextEditorWidget;
class PlainTextEditorFactory;
class BehaviorSettings;
class CompletionSettings;
class DisplaySettings;
class ExtraEncodingSettings;
class FontSettings;
class MarginSettings;
class StorageSettings;
class TypingSettings;
2008-12-02 12:01:29 +01:00
enum TextMarkRequestKind
{
BreakpointRequest,
BookmarkRequest,
TaskMarkRequest
};
class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
{
Q_OBJECT
public:
BaseTextEditor();
~BaseTextEditor() override;
virtual void finalizeInitialization() {}
static BaseTextEditor *currentTextEditor();
static QVector<BaseTextEditor *> textEditorsForDocument(TextDocument *textDocument);
TextEditorWidget *editorWidget() const;
TextDocument *textDocument() const;
// Some convenience text access
void setTextCursor(const QTextCursor &cursor);
QTextCursor textCursor() const;
QChar characterAt(int pos) const;
QString textAt(int from, int to) const;
void addContext(Utils::Id id);
// IEditor
Core::IDocument *document() const override;
2009-04-28 19:02:58 +02:00
IEditor *duplicate() override;
QByteArray saveState() const override;
void restoreState(const QByteArray &state) override;
QWidget *toolBar() override;
void contextHelp(const HelpCallback &callback) const override; // from IContext
void setContextHelp(const Core::HelpItem &item) override;
int currentLine() const override;
int currentColumn() const override;
void gotoLine(int line, int column = 0, bool centerLine = true) override;
/*! Returns the amount of visible columns (in characters) in the editor */
int columnCount() const;
/*! Returns the amount of visible lines (in characters) in the editor */
int rowCount() const;
/*! Returns the position at \a posOp in characters from the beginning of the document */
virtual int position(TextPositionOperation posOp = CurrentPosition, int at = -1) const;
/*! Converts the \a pos in characters from beginning of document to \a line and \a column */
virtual void convertPosition(int pos, int *line, int *column) const;
virtual QString selectedText() const;
/*! Removes \a length characters to the right of the cursor. */
virtual void remove(int length);
/*! Inserts the given string to the right of the cursor. */
virtual void insert(const QString &string);
/*! Replaces \a length characters to the right of the cursor with the given string. */
virtual void replace(int length, const QString &string);
/*! Sets current cursor position to \a pos. */
virtual void setCursorPosition(int pos);
/*! Selects text between current cursor position and \a toPos. */
virtual void select(int toPos);
private:
friend class TextEditorFactory;
friend class Internal::TextEditorFactoryPrivate;
Internal::BaseTextEditorPrivate *d;
};
class TEXTEDITOR_EXPORT TextEditorWidget : public QPlainTextEdit
2008-12-02 12:01:29 +01:00
{
Q_OBJECT
Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn)
Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
2008-12-02 12:01:29 +01:00
public:
explicit TextEditorWidget(QWidget *parent = nullptr);
~TextEditorWidget() override;
2008-12-02 12:01:29 +01:00
void setTextDocument(const QSharedPointer<TextDocument> &doc);
TextDocument *textDocument() const;
QSharedPointer<TextDocument> textDocumentPtr() const;
virtual void aboutToOpen(const QString &fileName, const QString &realFileName);
virtual void openFinishedSuccessfully();
// IEditor
2008-12-02 12:01:29 +01:00
QByteArray saveState() const;
virtual void restoreState(const QByteArray &state);
void gotoLine(int line, int column = 0, bool centerLine = true, bool animate = false);
int position(TextPositionOperation posOp = CurrentPosition,
int at = -1) const;
2008-12-02 12:01:29 +01:00
void convertPosition(int pos, int *line, int *column) const;
using QPlainTextEdit::cursorRect;
QRect cursorRect(int pos) const;
void setCursorPosition(int pos);
QToolBar *toolBar();
2008-12-02 12:01:29 +01:00
void print(QPrinter *);
void appendStandardContextMenuActions(QMenu *menu);
uint optionalActions();
void setOptionalActions(uint optionalActions);
void addOptionalActions(uint optionalActions);
void setAutoCompleter(AutoCompleter *autoCompleter);
AutoCompleter *autoCompleter() const;
2008-12-02 12:01:29 +01:00
// Works only in conjunction with a syntax highlighter that puts
// parentheses into text block user data
void setParenthesesMatchingEnabled(bool b);
bool isParenthesesMatchingEnabled() const;
void setHighlightCurrentLine(bool b);
bool highlightCurrentLine() const;
void setLineNumbersVisible(bool b);
bool lineNumbersVisible() const;
void setAlwaysOpenLinksInNextSplit(bool b);
bool alwaysOpenLinksInNextSplit() const;
2008-12-02 12:01:29 +01:00
void setMarksVisible(bool b);
bool marksVisible() const;
void setRequestMarkEnabled(bool b);
bool requestMarkEnabled() const;
void setLineSeparatorsAllowed(bool b);
bool lineSeparatorsAllowed() const;
bool codeFoldingVisible() const;
void setCodeFoldingSupported(bool b);
bool codeFoldingSupported() const;
void setMouseNavigationEnabled(bool b);
bool mouseNavigationEnabled() const;
void setMouseHidingEnabled(bool b);
bool mouseHidingEnabled() const;
void setScrollWheelZoomingEnabled(bool b);
bool scrollWheelZoomingEnabled() const;
void setConstrainTooltips(bool b);
bool constrainTooltips() const;
void setCamelCaseNavigationEnabled(bool b);
bool camelCaseNavigationEnabled() const;
2008-12-02 12:01:29 +01:00
void setRevisionsVisible(bool b);
bool revisionsVisible() const;
void setVisibleWrapColumn(int column);
int visibleWrapColumn() const;
int columnCount() const;
int rowCount() const;
2008-12-02 12:01:29 +01:00
void setReadOnly(bool b);
void insertCodeSnippet(const QTextCursor &cursor, const QString &snippet);
void setBlockSelection(bool on);
void setBlockSelection(int positionBlock, int positionColumn, int anchhorBlock,
int anchorColumn);
void setBlockSelection(const QTextCursor &cursor);
QTextCursor blockSelection() const;
bool hasBlockSelection() const;
int verticalBlockSelectionFirstColumn() const;
int verticalBlockSelectionLastColumn() const;
QRegion translatedLineRegion(int lineStart, int lineEnd) const;
QPoint toolTipPosition(const QTextCursor &c) const;
void showTextMarksToolTip(const QPoint &pos,
const TextMarks &marks,
const TextMark *mainTextMark = nullptr) const;
void invokeAssist(AssistKind assistKind, IAssistProvider *provider = nullptr);
virtual TextEditor::AssistInterface *createAssistInterface(AssistKind assistKind,
AssistReason assistReason) const;
static QMimeData *duplicateMimeData(const QMimeData *source);
static QString msgTextTooLarge(quint64 size);
void insertPlainText(const QString &text);
QWidget *extraArea() const;
virtual int extraAreaWidth(int *markWidthPtr = nullptr) const;
virtual void extraAreaPaintEvent(QPaintEvent *);
virtual void extraAreaLeaveEvent(QEvent *);
virtual void extraAreaContextMenuEvent(QContextMenuEvent *);
virtual void extraAreaMouseEvent(QMouseEvent *);
void updateFoldingHighlight(const QPoint &pos);
void setLanguageSettingsId(Utils::Id settingsId);
Utils::Id languageSettingsId() const;
void setCodeStyle(ICodeStylePreferences *settings);
const DisplaySettings &displaySettings() const;
const MarginSettings &marginSettings() const;
const BehaviorSettings &behaviorSettings() const;
void ensureCursorVisible();
void ensureBlockIsUnfolded(QTextBlock block);
static Utils::Id FakeVimSelection;
static Utils::Id SnippetPlaceholderSelection;
static Utils::Id CurrentLineSelection;
static Utils::Id ParenthesesMatchingSelection;
static Utils::Id AutoCompleteSelection;
static Utils::Id CodeWarningsSelection;
static Utils::Id CodeSemanticsSelection;
static Utils::Id UndefinedSymbolSelection;
static Utils::Id UnusedSymbolSelection;
static Utils::Id OtherSelection;
static Utils::Id ObjCSelection;
static Utils::Id DebuggerExceptionSelection;
void setExtraSelections(Utils::Id kind, const QList<QTextEdit::ExtraSelection> &selections);
QList<QTextEdit::ExtraSelection> extraSelections(Utils::Id kind) const;
QString extraSelectionTooltip(int pos) const;
RefactorMarkers refactorMarkers() const;
void setRefactorMarkers(const RefactorMarkers &markers);
// the blocks list must be sorted
void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
enum Side { Left, Right };
QAction *insertExtraToolBarWidget(Side side, QWidget *widget);
// keep the auto completion even if the focus is lost
void keepAutoCompletionHighlight(bool keepHighlight);
void setAutoCompleteSkipPosition(const QTextCursor &cursor);
virtual void copy();
virtual void paste();
virtual void cut();
virtual void selectAll();
2008-12-02 12:01:29 +01:00
virtual void autoIndent();
virtual void rewrapParagraph();
virtual void unCommentSelection();
virtual void autoFormat();
virtual void encourageApply();
virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
virtual void setMarginSettings(const TextEditor::MarginSettings &);
void setBehaviorSettings(const TextEditor::BehaviorSettings &);
void setTypingSettings(const TextEditor::TypingSettings &);
void setStorageSettings(const TextEditor::StorageSettings &);
void setCompletionSettings(const TextEditor::CompletionSettings &);
void setExtraEncodingSettings(const TextEditor::ExtraEncodingSettings &);
void circularPaste();
void switchUtf8bom();
void zoomF(float delta);
void zoomReset();
2008-12-02 12:01:29 +01:00
void cutLine();
void copyLine();
void duplicateSelection();
void duplicateSelectionAndComment();
2008-12-02 12:01:29 +01:00
void deleteLine();
void deleteEndOfLine();
void deleteEndOfWord();
void deleteEndOfWordCamelCase();
void deleteStartOfLine();
void deleteStartOfWord();
void deleteStartOfWordCamelCase();
void unfoldAll();
void fold();
void unfold();
2008-12-02 12:01:29 +01:00
void selectEncoding();
void updateTextCodecLabel();
void selectLineEnding(int index);
void updateTextLineEndingLabel();
2008-12-02 12:01:29 +01:00
void gotoBlockStart();
void gotoBlockEnd();
void gotoBlockStartWithSelection();
void gotoBlockEndWithSelection();
void gotoDocumentStart();
void gotoDocumentEnd();
void gotoLineStart();
void gotoLineStartWithSelection();
void gotoLineEnd();
void gotoLineEndWithSelection();
void gotoNextLine();
void gotoNextLineWithSelection();
void gotoPreviousLine();
void gotoPreviousLineWithSelection();
void gotoPreviousCharacter();
void gotoPreviousCharacterWithSelection();
void gotoNextCharacter();
void gotoNextCharacterWithSelection();
void gotoPreviousWord();
void gotoPreviousWordWithSelection();
void gotoNextWord();
void gotoNextWordWithSelection();
void gotoPreviousWordCamelCase();
void gotoPreviousWordCamelCaseWithSelection();
void gotoNextWordCamelCase();
void gotoNextWordCamelCaseWithSelection();
virtual bool selectBlockUp();
virtual bool selectBlockDown();
void selectWordUnderCursor();
void showContextMenu();
void moveLineUp();
void moveLineDown();
void viewPageUp();
void viewPageDown();
void viewLineUp();
void viewLineDown();
void copyLineUp();
void copyLineDown();
void joinLines();
void insertLineAbove();
void insertLineBelow();
void uppercaseSelection();
void lowercaseSelection();
void sortSelectedLines();
void cleanWhitespace();
void indent();
void unindent();
void undo();
void redo();
void openLinkUnderCursor();
void openLinkUnderCursorInNextSplit();
virtual void findUsages();
virtual void renameSymbolUnderCursor();
/// Abort code assistant if it is running.
void abortAssist();
void configureGenericHighlighter();
Q_INVOKABLE void inSnippetMode(bool *active); // Used by FakeVim.
/*! Returns the document line number for the visible \a row.
*
* The first visible row is 0, the last visible row is rowCount() - 1.
*
* Any invalid row will return -1 as line number.
*/
int blockNumberForVisibleRow(int row) const;
/*! Returns the first visible line of the document. */
int firstVisibleBlockNumber() const;
/*! Returns the last visible line of the document. */
int lastVisibleBlockNumber() const;
/*! Returns the line visible closest to the vertical center of the editor. */
int centerVisibleBlockNumber() const;
Core::HighlightScrollBarController *highlightScrollBarController() const;
void addHoverHandler(BaseHoverHandler *handler);
void removeHoverHandler(BaseHoverHandler *handler);
2008-12-02 12:01:29 +01:00
signals:
void assistFinished(); // Used in tests.
void readOnlyChanged();
void requestBlockUpdate(const QTextBlock &);
2008-12-02 12:01:29 +01:00
Introduce a basic client for the language server protocol The language server protocol is used to transport language specific information needed to efficiently edit source files. For example completion, go to operations and symbol information. These information are transferred via JSON-RPC. The complete definition can be found under https://microsoft.github.io/language-server-protocol/specification. This language server protocol support consists of two major parts, the C++ representation of the language server protocol, and the client part for the communication with an external language server. The TypeScript definitions of the protocol interfaces are transferred to C++ classes. Those classes have getter and setter for every interface value. Optional values from the protocol are represented by Utils::optional<ValueType>. The JSON objects that are used to transfer the data between client and server are hidden by a specialized JsonObject class derived from QJsonObject. Additionally this JsonObject provides a validity check that is capable of creating a detailed error message for malformed, or at least unexpected JSON representation of the protocol. The client is the interface between Qt Creator and language server functionality, like completion, diagnostics, document and workspace synchronization. The base client converts the data that is sent from/to the server between the raw byte array and the corresponding C++ objects. The transportat layer is defined in a specialized base client (this initial change will only support stdio language server). The running clients are handled inside the language client manager, which is also used to connect global and exclusive Qt Creator functionality to the clients. Task-number: QTCREATORBUG-20284 Change-Id: I8e123e20c3f14ff7055c505319696d5096fe1704 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-13 12:33:46 +02:00
void requestLinkAt(const QTextCursor &cursor, Utils::ProcessLinkCallback &callback,
bool resolveTarget, bool inNextSplit);
void requestUsages(const QTextCursor &cursor);
void requestRename(const QTextCursor &cursor);
void optionalActionMaskChanged();
Introduce a basic client for the language server protocol The language server protocol is used to transport language specific information needed to efficiently edit source files. For example completion, go to operations and symbol information. These information are transferred via JSON-RPC. The complete definition can be found under https://microsoft.github.io/language-server-protocol/specification. This language server protocol support consists of two major parts, the C++ representation of the language server protocol, and the client part for the communication with an external language server. The TypeScript definitions of the protocol interfaces are transferred to C++ classes. Those classes have getter and setter for every interface value. Optional values from the protocol are represented by Utils::optional<ValueType>. The JSON objects that are used to transfer the data between client and server are hidden by a specialized JsonObject class derived from QJsonObject. Additionally this JsonObject provides a validity check that is capable of creating a detailed error message for malformed, or at least unexpected JSON representation of the protocol. The client is the interface between Qt Creator and language server functionality, like completion, diagnostics, document and workspace synchronization. The base client converts the data that is sent from/to the server between the raw byte array and the corresponding C++ objects. The transportat layer is defined in a specialized base client (this initial change will only support stdio language server). The running clients are handled inside the language client manager, which is also used to connect global and exclusive Qt Creator functionality to the clients. Task-number: QTCREATORBUG-20284 Change-Id: I8e123e20c3f14ff7055c505319696d5096fe1704 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-13 12:33:46 +02:00
2008-12-02 12:01:29 +01:00
protected:
QTextBlock blockForVisibleRow(int row) const;
QTextBlock blockForVerticalOffset(int offset) const;
bool event(QEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;
void inputMethodEvent(QInputMethodEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
void wheelEvent(QWheelEvent *e) override;
void changeEvent(QEvent *e) override;
void focusInEvent(QFocusEvent *e) override;
void focusOutEvent(QFocusEvent *e) override;
void showEvent(QShowEvent *) override;
bool viewportEvent(QEvent *event) override;
void resizeEvent(QResizeEvent *) override;
void paintEvent(QPaintEvent *) override;
virtual void paintBlock(QPainter *painter,
const QTextBlock &block,
const QPointF &offset,
const QVector<QTextLayout::FormatRange> &selections,
const QRect &clipRect) const;
void timerEvent(QTimerEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void mouseDoubleClickEvent(QMouseEvent *) override;
void leaveEvent(QEvent *) override;
void keyReleaseEvent(QKeyEvent *) override;
void dragEnterEvent(QDragEnterEvent *e) override;
QMimeData *createMimeDataFromSelection() const override;
bool canInsertFromMimeData(const QMimeData *source) const override;
void insertFromMimeData(const QMimeData *source) override;
2008-12-02 12:01:29 +01:00
virtual QString plainTextFromSelection(const QTextCursor &cursor) const;
static QString convertToPlainText(const QString &txt);
virtual QString lineNumber(int blockNumber) const;
virtual int lineNumberDigits() const;
virtual bool selectionVisible(int blockNumber) const;
virtual bool replacementVisible(int blockNumber) const;
virtual QColor replacementPenColor(int blockNumber) const;
virtual void triggerPendingUpdates();
virtual void applyFontSettings();
2008-12-02 12:01:29 +01:00
void showDefaultContextMenu(QContextMenuEvent *e, Utils::Id menuContextId);
virtual void finalizeInitialization() {}
virtual void finalizeInitializationAfterDuplication(TextEditorWidget *) {}
static QTextCursor flippedCursor(const QTextCursor &cursor);
public:
QString selectedText() const;
void setupGenericHighlighter();
void setupFallBackEditor(Utils::Id id);
void remove(int length);
void replace(int length, const QString &string);
QChar characterAt(int pos) const;
QString textAt(int from, int to) const;
void contextHelpItem(const Core::IContext::HelpCallback &callback);
void setContextHelpItem(const Core::HelpItem &item);
static TextEditorWidget *currentTextEditorWidget();
static TextEditorWidget *fromEditor(const Core::IEditor *editor);
protected:
/*!
Reimplement this function to enable code navigation.
\a resolveTarget is set to true when the target of the link is relevant
(it isn't until the link is used).
*/
virtual void findLinkAt(const QTextCursor &,
Utils::ProcessLinkCallback &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false);
/*!
Returns whether the link was opened successfully.
*/
bool openLink(const Utils::Link &link, bool inNextSplit = false);
/*!
Reimplement this function to change the default replacement text.
*/
virtual QString foldReplacementText(const QTextBlock &block) const;
virtual void drawCollapsedBlockPopup(QPainter &painter,
const QTextBlock &block,
QPointF offset,
const QRect &clip);
int visibleFoldedBlockNumber() const;
void doSetTextCursor(const QTextCursor &cursor) override;
void doSetTextCursor(const QTextCursor &cursor, bool keepBlockSelection);
signals:
void markRequested(TextEditor::TextEditorWidget *widget,
int line, TextEditor::TextMarkRequestKind kind);
void markContextMenuRequested(TextEditor::TextEditorWidget *widget,
int line, QMenu *menu);
void tooltipOverrideRequested(TextEditor::TextEditorWidget *widget,
const QPoint &globalPos, int position, bool *handled);
void tooltipRequested(const QPoint &globalPos, int position);
void activateEditor(Core::EditorManager::OpenEditorFlags flags = {});
protected:
virtual void slotCursorPositionChanged(); // Used in VcsBase
virtual void slotCodeStyleSettingsChanged(const QVariant &); // Used in CppEditor
2008-12-02 12:01:29 +01:00
bool inFindScope(const QTextCursor &cursor);
bool inFindScope(int selectionStart, int selectionEnd);
private:
Internal::TextEditorWidgetPrivate *d;
friend class BaseTextEditor;
friend class TextEditorFactory;
friend class Internal::TextEditorFactoryPrivate;
friend class Internal::TextEditorWidgetPrivate;
friend class Internal::TextEditorOverlay;
friend class RefactorOverlay;
2008-12-02 12:01:29 +01:00
};
class TEXTEDITOR_EXPORT TextEditorLinkLabel : public Utils::ElidingLabel
{
public:
TextEditorLinkLabel(QWidget *parent = nullptr);
void setLink(Utils::Link link);
Utils::Link link() const;
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
private:
QPoint m_dragStartPosition;
Utils::Link m_link;
};
class TEXTEDITOR_EXPORT TextEditorFactory : public Core::IEditorFactory
{
public:
TextEditorFactory();
~TextEditorFactory() override;
using EditorCreator = std::function<BaseTextEditor *()>;
using DocumentCreator = std::function<TextDocument *()>;
// editor widget must be castable (qobject_cast or Aggregate::query) to TextEditorWidget
using EditorWidgetCreator = std::function<QWidget *()>;
using SyntaxHighLighterCreator = std::function<SyntaxHighlighter *()>;
using IndenterCreator = std::function<Indenter *(QTextDocument *)>;
using AutoCompleterCreator = std::function<AutoCompleter *()>;
void setDocumentCreator(const DocumentCreator &creator);
void setEditorWidgetCreator(const EditorWidgetCreator &creator);
void setEditorCreator(const EditorCreator &creator);
void setIndenterCreator(const IndenterCreator &creator);
void setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator);
void setUseGenericHighlighter(bool enabled);
void setAutoCompleterCreator(const AutoCompleterCreator &creator);
void setEditorActionHandlers(uint optionalActions);
void addHoverHandler(BaseHoverHandler *handler);
void setCompletionAssistProvider(CompletionAssistProvider *provider);
void setCommentDefinition(Utils::CommentDefinition definition);
void setDuplicatedSupported(bool on);
void setMarksVisible(bool on);
void setParenthesesMatchingEnabled(bool on);
void setCodeFoldingSupported(bool on);
private:
friend class BaseTextEditor;
friend class PlainTextEditorFactory;
Internal::TextEditorFactoryPrivate *d;
};
2008-12-02 12:01:29 +01:00
} // namespace TextEditor
QT_BEGIN_NAMESPACE
uint qHash(const QColor &color);
QT_END_NAMESPACE