QCodeEdit
2.2
|
A text editing widget. More...
Classes | |
struct | PlaceHolder |
A small structure holding placeholder data. More... | |
Signals | |
void | loaded (QEditor *e, const QString &s) |
void | saved (QEditor *e, const QString &s) |
void | contentModified (bool y) |
void | titleChanged (const QString &title) |
void | textEdited (QKeyEvent *e) |
void | cursorPositionChanged () |
void | copyAvailable (bool y) |
void | undoAvailable (bool y) |
void | redoAvailable (bool y) |
void | markChanged (const QString &f, QDocumentLineHandle *l, int mark, bool on) |
Public Member Functions | |
int | horizontalOffset () const |
int | verticalOffset () const |
QPoint | mapToContents (const QPoint &point) const |
QPoint | mapFromContents (const QPoint &point) const |
Static Public Member Functions | |
static QEditorInputBindingInterface * | registeredInputBinding (const QString &n) |
static const QList< QEditor * > & | editors () |
Protected Types | |
enum | SaveState { Undefined, Saving, Saved, Conflict } |
Protected Attributes | |
QString | m_name |
QString | m_fileName |
QMenu * | pMenu |
QHash< QString, QAction * > | m_actions |
QMenu * | m_lineEndingsMenu |
QActionGroup * | m_lineEndingsActions |
QMenu * | m_bindingsMenu |
QAction * | aDefaultBinding |
QActionGroup * | m_bindingsActions |
char | m_saveState |
quint16 | m_checksum |
QDocument * | m_doc |
QTextCodec * | m_codec |
QList< QEditorInputBindingInterface * > | m_bindings |
QLanguageDefinition * | m_definition |
QPointer< QCodeCompletionEngine > | m_completionEngine |
QDocumentCursor | m_cursor |
QDocumentCursor | m_doubleClick |
QDocumentCursor | m_dragAndDrop |
QList< QDocumentCursor > | m_mirrors |
int | m_curPlaceHolder |
int | m_cphOffset |
QList< PlaceHolder > | m_placeHolders |
int | m_state |
bool | m_selection |
QRect | m_crect |
QRect | m_margins |
QPoint | m_clickPoint |
QPoint | m_dragPoint |
QBasicTimer | m_blink |
QBasicTimer | m_scroll |
QBasicTimer | m_click |
QBasicTimer | m_drag |
Friends | |
class | QEditConfig |
class | QEditorFactory |
enum | CodecUpdatePolicy { NoUpdate = 0, UpdateOld = 1, UpdateDefault = 2, UpdateCustom = 4, UpdateAll = 7 } |
Specify the actions to take when changing the default codec. | |
enum | EditFlag { None = 0, Overwrite = 0x001, CursorOn = 0x002, ReadOnly = 0x004, MousePressed = 0x008, MaybeDrag = 0x010, Selection = 0x020, EnsureVisible = 0x040, FoldedCursor = 0x100, Internal = 0x00000fff, LineWrap = 0x00001000, CtrlNavigation = 0x00010000, CursorJumpPastWrap = 0x00020000, ReplaceTabs = 0x00100000, RemoveTrailing = 0x00200000, PreserveTrailingIndent = 0x00400000, AdjustIndent = 0x00800000, AutoCloseChars = 0x01000000, AutoIndent = 0x02000000, Accessible = 0xfffff000 } |
Flag holding information about the state of an editor. More... | |
static int | m_defaultFlags = QEditor::AutoIndent | QEditor::AdjustIndent |
static QTextCodec * | m_defaultCodec = 0 |
static QList< QEditor * > | m_editors |
static QEditorInputBindingInterface * | m_defaultBinding = 0 |
static QHash< QString, QEditorInputBindingInterface * > | m_registeredBindings |
QEditor (QWidget *p=0) | |
ctor More... | |
QEditor (bool actions, QWidget *p=0) | |
ctor More... | |
QEditor (const QString &s, QWidget *p=0) | |
ctor More... | |
QEditor (const QString &s, bool actions, QWidget *p=0) | |
ctor More... | |
virtual | ~QEditor () |
dtor | |
bool | flag (EditFlag) const |
bool | canUndo () const |
bool | canRedo () const |
QString | text () const |
QString | text (int line) const |
QTextCodec * | codec () const |
QDocument * | document () const |
QList< QEditorInputBindingInterface * > | inputBindings () const |
bool | isCursorVisible () const |
QDocumentCursor | cursor () const |
int | cursorMirrorCount () const |
QDocumentCursor | cursorMirror (int i) const |
QLanguageDefinition * | languageDefinition () const |
QCodeCompletionEngine * | completionEngine () const |
QAction * | action (const QString &s) |
virtual QRect | cursorRect () const |
virtual QRect | selectionRect () const |
virtual QRect | lineRect (int line) const |
virtual QRect | lineRect (const QDocumentLine &l) const |
virtual QRect | cursorRect (const QDocumentCursor &c) const |
QString | name () const |
QString | fileName () const |
bool | isContentModified () const |
bool | isInConflict () const |
int | wrapWidth () const |
virtual bool | protectedCursor (const QDocumentCursor &c) const |
void | setFlag (EditFlag f, bool b) |
Sets the flag f. | |
void | pageUp (QDocumentCursor::MoveMode moveMode) |
Go up by one page. More... | |
void | pageDown (QDocumentCursor::MoveMode moveMode) |
Go down by one page. More... | |
void | selectionChange (bool force=false) |
Does not do anything anymore... More... | |
void | repaintCursor () |
Request repaint (using QWidget::update()) for the region occupied by the cursor. | |
void | ensureCursorVisible () |
Ensure that the current cursor is visible. | |
void | ensureVisible (int line) |
ensure that a given line is visible by updating scrollbars if needed | |
void | ensureVisible (const QRect &rect) |
Ensure that a given rect is visible by updating scrollbars if needed. | |
void | preInsert (QDocumentCursor &c, const QString &text) |
void | insertText (QDocumentCursor &c, const QString &text) |
Insert some text at a given cursor position. More... | |
QDocumentLine | lineAtPosition (const QPoint &p) const |
QDocumentCursor | cursorForPosition (const QPoint &p) const |
void | setClipboardSelection () |
void | setCursorPosition (const QPoint &p) |
Set the cursor to that nearest to a given viewport position. | |
void | setCursorPosition (int line, int index) |
Set the cursor. More... | |
void | getCursorPosition (int &line, int &index) |
Write the current cursor position to to integers. | |
void | clearCursorMirrors () |
Removes all cursor mirrors. | |
void | addCursorMirror (const QDocumentCursor &c) |
Add a cursor mirror. | |
static int | defaultFlags () |
static void | setDefaultFlags (int f) |
Set the default editor flags. More... | |
static QTextCodec * | defaultCodec () |
static void | setDefaultCodec (int mib, int update) |
static void | setDefaultCodec (QTextCodec *c, int update) |
Set the default text codec. More... | |
static void | setDefaultCodec (const char *name, int update) |
static void | setDefaultCodec (const QByteArray &name, int update) |
static QString | defaultInputBindingId () |
static QStringList | registeredInputBindingIds () |
static void | registerInputBinding (QEditorInputBindingInterface *b) |
Add an input binding to make it available for all editors. | |
static void | unregisterInputBinding (QEditorInputBindingInterface *b) |
Remove an input binding from the pool of publicly available ones. | |
static void | setDefaultInputBinding (QEditorInputBindingInterface *b) |
Set the default input binding. More... | |
static void | setDefaultInputBinding (const QString &b) |
Set the default input binding. More... | |
void | undo () |
Undo the last editing operation, if any on the stack. | |
void | redo () |
Redo the last undone editing operation, if any on the stack. | |
void | cut () |
Cut the selected text, if any. | |
void | copy () |
Copy the selected text, if any. More... | |
void | paste () |
Paste text from the clipboard to the current cursor position. More... | |
void | selectAll () |
Select the whole text. | |
void | find () |
Show the search/replace panel, if any. | |
void | findNext () |
Ask the search/replace panel, if any, to move to next match. | |
void | replace () |
Show the search/replace panel, if any. | |
void | gotoLine () |
Show a panel or dialog to go to a specific line. | |
void | indentSelection () |
Indent the selection. | |
void | unindentSelection () |
Unindent the selection. | |
void | commentSelection () |
Comment the selection (or the current line) using single line comments supported by the language. | |
void | uncommentSelection () |
Uncomment the selection (or current line), provided it has been commented with single line comments. | |
void | setLineWrapping (bool on) |
Set line wrapping. More... | |
virtual void | save () |
Save the underlying document to a file. More... | |
void | save (const QString &filename) |
Save the content of the editor to a file. More... | |
virtual void | print () |
Print the content of the editor. | |
virtual void | retranslate () |
Run time translation entry point for compat with Edyuk. | |
virtual void | write (const QString &s) |
Write some text at the current cursor position. More... | |
void | addAction (QAction *a, const QString &menu, const QString &toolbar=QString()) |
Add an action to the editor. More... | |
void | removeAction (QAction *a, const QString &menu, const QString &toolbar=QString()) |
remove an action form the editor More... | |
void | load (const QString &file) |
load a text file More... | |
void | setText (const QString &s) |
Set the text of the underlying document and update display. | |
void | setCodec (int mib) |
void | setCodec (QTextCodec *c) |
Set the text codec to use for load/save operations. | |
void | setCodec (const char *name) |
void | setCodec (const QByteArray &name) |
void | setDocument (QDocument *d) |
void | addInputBinding (QEditorInputBindingInterface *b) |
Set the current input binding. | |
void | removeInputBinding (QEditorInputBindingInterface *b) |
Set the current input binding. | |
void | setInputBinding (QEditorInputBindingInterface *b) |
Set the current input binding. | |
void | setCursor (const QDocumentCursor &c) |
Set the document cursor. | |
void | setLanguageDefinition (QLanguageDefinition *d) |
Set a language definition to the editor. | |
void | setCompletionEngine (QCodeCompletionEngine *e) |
Set a code completion engine to the editor. More... | |
void | zoom (int n) |
Zoom. More... | |
void | setPanelMargins (int l, int t, int r, int b) |
Change the viewport margins to make room for panels. More... | |
void | getPanelMargins (int *l, int *t, int *r, int *b) const |
Obtain the value of panel margins. More... | |
void | setTitle (const QString &title) |
Set the title of the widget. More... | |
void | highlight () |
Force a full re-highlighting of the document. | |
void | clearPlaceHolders () |
Clear all placeholders. | |
void | removePlaceHolder (int i) |
Remove a placeholder. More... | |
void | addPlaceHolder (const PlaceHolder &p, bool autoUpdate=true) |
Add a placeholder. More... | |
int | placeHolderCount () const |
int | currentPlaceHolder () const |
void | nextPlaceHolder () |
Move to next placeholder. More... | |
void | previousPlaceHolder () |
Move to previous placeholder. More... | |
void | setPlaceHolder (int i) |
Set the current placeholder to use. More... | |
virtual void | setFileName (const QString &f) |
Changes the file name. More... | |
void | checkClipboard () |
void | reconnectWatcher () |
void | fileChanged (const QString &f) |
void | setContentClean (bool y) |
Notify that the content is clean (modifications undone or document saved) More... | |
void | emitCursorPositionChanged () |
Emitted whenever the position of the cursor changes. | |
virtual void | setContentModified (bool y) |
Notify that the content has been modified. More... | |
virtual bool | event (QEvent *e) |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | timerEvent (QTimerEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | inputMethodEvent (QInputMethodEvent *e) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
virtual void | dragEnterEvent (QDragEnterEvent *e) |
virtual void | dragLeaveEvent (QDragLeaveEvent *e) |
virtual void | dragMoveEvent (QDragMoveEvent *e) |
virtual void | dropEvent (QDropEvent *e) |
virtual void | changeEvent (QEvent *e) |
virtual void | showEvent (QShowEvent *) |
virtual void | wheelEvent (QWheelEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
virtual void | focusInEvent (QFocusEvent *e) |
virtual void | focusOutEvent (QFocusEvent *e) |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
Context menu event. More... | |
virtual void | closeEvent (QCloseEvent *e) |
Close event. More... | |
virtual bool | focusNextPrevChild (bool next) |
Prevent tab key press to be considered as widget navigation. | |
virtual bool | moveKeyEvent (QDocumentCursor &c, QKeyEvent *e, bool *leave) |
Handle cursor movements upon key event. | |
virtual bool | isProcessingKeyEvent (QKeyEvent *e, int *offset=0) |
Determine whether a given key event is an editing operation. | |
virtual bool | processCursor (QDocumentCursor &c, QKeyEvent *e, bool &b) |
virtual void | startDrag () |
Start a drag and drop operation using the current selection. | |
virtual QMimeData * | createMimeDataFromSelection () const |
creates a valid QMimeData object depending on the selection | |
virtual void | insertFromMimeData (const QMimeData *d) |
Inserts the content of a QMimeData object at the cursor position. More... | |
virtual void | scrollContentsBy (int dx, int dy) |
void | init (bool actions=true) |
void | updateBindingsMenu () |
void | documentWidthChanged (int newWidth) |
void | documentHeightChanged (int newWidth) |
void | repaintContent (int i, int n) |
void | updateContent (int i, int n) |
void | markChanged (QDocumentLineHandle *l, int mark, bool on) |
void | bindingSelected (QAction *a) |
void | lineEndingSelected (QAction *a) |
void | lineEndingChanged (int lineEnding) |
static QReliableFileWatch * | watcher () |
A text editing widget.
QEditor is the central widget in QCE. It allows user to view and edit a document.
QEditor has an API similar to that of QTextEdit and it behaves in a very similar way.
Notable differences are :
QEditor can gain features when it is managed by a QCodeEdit class which is responsible for panels management.
enum QEditor::EditFlag |
Flag holding information about the state of an editor.
Some of these are public and can be modified freely and some others are only meant to be used internally though they can still be read.
QEditor::QEditor | ( | QWidget * | p = 0 | ) |
ctor
QEditor::QEditor | ( | bool | actions, |
QWidget * | p = 0 |
||
) |
ctor
actions | Whether builtin actions and menus should be created |
QEditor::QEditor | ( | const QString & | s, |
QWidget * | p = 0 |
||
) |
QEditor::QEditor | ( | const QString & | s, |
bool | actions, | ||
QWidget * | p = 0 |
||
) |
ctor
s | file to load |
actions | Whether builtin actions and menus should be created |
References setText().
QAction * QEditor::action | ( | const QString & | s | ) |
Referenced by startDrag().
|
slot |
Add an action to the editor.
a | action to add |
menu | if not empty (and if QCE is built with qmdilib support) the action will be added to that menu |
toolbar | similar to menu but acts on toolbars |
|
slot |
Add a placeholder.
p | placeholder data |
autoUpdate | whether to force auto updating of all cursors used by the placeholder |
Auto update is on by default and it is recommended not to disable it unless you know what you are doing.
References QDocumentCursor::movePosition(), and QDocumentCursor::setAutoUpdated().
Referenced by QSnippetInsertionCommand::redo().
bool QEditor::canRedo | ( | ) | const |
References QDocument::canRedo().
bool QEditor::canUndo | ( | ) | const |
References QDocument::canUndo().
|
protectedvirtual |
Close event.
When build with qmdilib support (e.g in Edyuk) this check for modifications and a dialog pops up to offer various options (like saving, discarding or canceling)
References isContentModified().
QTextCodec * QEditor::codec | ( | ) | const |
Referenced by setDefaultCodec().
QCodeCompletionEngine * QEditor::completionEngine | ( | ) | const |
|
protectedvirtual |
Context menu event.
All the (managed) actions added to the editor are showed in it by default.
References selectionChange().
|
slot |
Copy the selected text, if any.
References createMimeDataFromSelection(), and QDocumentCursor::hasSelection().
|
slot |
QDocumentCursor QEditor::cursor | ( | ) | const |
References copy().
Referenced by QGotoLinePanel::editorChange(), isCursorVisible(), moveKeyEvent(), QStatusPanel::paint(), and QCodeCompletionEngine::textEdited().
QDocumentCursor QEditor::cursorForPosition | ( | const QPoint & | p | ) | const |
References QDocument::cursorAt().
Referenced by setCursorPosition().
QDocumentCursor QEditor::cursorMirror | ( | int | i | ) | const |
Index has no extra meaning : you cannot deduce anything about the cursor mirror it corresponds to from it. For instance, the cursor mirror at index 0 is neither the first mirror added nor the one at smallest document position (well : it might be but that would be a coincidence...)
int QEditor::cursorMirrorCount | ( | ) | const |
|
virtual |
This will either return a cursorRect for the current cursor or the selectionRect() if the cursor has a selection.
The cursor position, which would be the top left corner of the actual rectangle occupied by the cursor can be obtained using QDocumentCursor::documentPosition()
The behavior of this method may surprise newcomers but it is actually quite sensible as this rectangle is mainly used to specify the update rect of the widget and the whole line needs to be updated to properly update the line background whenever the cursor move from a line to another.
References QDocumentCursor::hasSelection(), and selectionRect().
Referenced by repaintCursor(), and selectionRect().
|
virtual |
References QDocumentCursor::lineNumber(), and lineRect().
|
static |
Referenced by QEditConfig::cancel().
|
static |
Referenced by QEditConfig::apply(), and QEditConfig::cancel().
|
static |
QDocument * QEditor::document | ( | ) | const |
Referenced by QLineMarksInfoCenter::addLineMark(), QFormatConfig::apply(), QLineNumberPanel::editorChange(), QGotoLinePanel::editorChange(), QFoldPanel::mousePressEvent(), QFoldPanel::paint(), QLineMarksInfoCenter::removeLineMark(), setDefaultFlags(), and QLineMarksInfoCenter::toggleLineMark().
QString QEditor::fileName | ( | ) | const |
Referenced by save(), setCodec(), and setFileName().
bool QEditor::flag | ( | EditFlag | f | ) | const |
Referenced by indentSelection(), insertText(), isProcessingKeyEvent(), moveKeyEvent(), QStatusPanel::paint(), save(), and setPanelMargins().
|
slot |
Obtain the value of panel margins.
l | left margin |
t | top margin |
r | right margin |
b | bottom margin |
QList< QEditorInputBindingInterface * > QEditor::inputBindings | ( | ) | const |
|
protectedvirtual |
Inserts the content of a QMimeData object at the cursor position.
References addCursorMirror(), QDocument::beginMacro(), clearCursorMirrors(), QDocumentCursor::columnNumber(), QDocument::endMacro(), QDocumentCursor::hasSelection(), insertText(), QDocumentCursor::isValid(), QDocumentCursor::removeSelectedText(), and QDocumentCursor::setColumnNumber().
Referenced by paste().
void QEditor::insertText | ( | QDocumentCursor & | c, |
const QString & | text | ||
) |
Insert some text at a given cursor position.
This function is provided to keep indenting/outdenting working when editing
References QDocumentCursor::columnNumber(), QDocumentCursor::deleteChar(), QDocumentLine::firstChar(), flag(), QDocumentCursor::hasSelection(), QLanguageDefinition::indent(), QDocumentCursor::insertLine(), QDocumentCursor::insertText(), QDocumentCursor::line(), QDocumentCursor::removeSelectedText(), QDocument::tabStop(), QDocumentLine::text(), and text().
Referenced by insertFromMimeData(), and write().
bool QEditor::isContentModified | ( | ) | const |
References QDocument::isClean().
Referenced by closeEvent(), QStatusPanel::paint(), and setCodec().
bool QEditor::isCursorVisible | ( | ) | const |
References cursor(), QDocumentCursor::documentPosition(), and QDocument::fontMetrics().
bool QEditor::isInConflict | ( | ) | const |
File conflicts happen when the loaded file is modified on disk by another application if the text has been modified in QCE
Referenced by save().
QLanguageDefinition * QEditor::languageDefinition | ( | ) | const |
Referenced by QFoldPanel::mousePressEvent(), QFoldPanel::paint(), and QLanguageFactory::setLanguage().
QDocumentLine QEditor::lineAtPosition | ( | const QPoint & | p | ) | const |
References QDocument::lineAt().
|
virtual |
The width of the returned rectangle will always be the viewport width.
References QDocument::lineRect().
Referenced by cursorRect().
|
virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References QDocument::lineRect().
|
slot |
load a text file
file | file to load |
If the file cannot be loaded, previous content is cleared.
References QDocument::addChunk(), QDocument::height(), QDocument::originalLineEnding(), setCursor(), setFileName(), QDocument::setLastModified(), setText(), QDocument::startChunkLoading(), QDocument::stopChunkLoading(), and QDocument::width().
Referenced by save(), and setCodec().
QString QEditor::name | ( | ) | const |
Referenced by setCodec(), setDefaultCodec(), and setFileName().
|
slot |
Move to next placeholder.
References setPlaceHolder().
Referenced by QSnippetInsertionCommand::redo().
void QEditor::pageDown | ( | QDocumentCursor::MoveMode | moveMode | ) |
Go down by one page.
References QDocumentCursor::atEnd(), clearCursorMirrors(), emitCursorPositionChanged(), ensureCursorVisible(), QDocument::fontMetrics(), QDocumentCursor::movePosition(), and repaintCursor().
Referenced by moveKeyEvent().
void QEditor::pageUp | ( | QDocumentCursor::MoveMode | moveMode | ) |
Go up by one page.
References QDocumentCursor::atStart(), clearCursorMirrors(), emitCursorPositionChanged(), ensureCursorVisible(), QDocument::fontMetrics(), QDocumentCursor::movePosition(), and repaintCursor().
Referenced by moveKeyEvent().
|
slot |
Paste text from the clipboard to the current cursor position.
References insertFromMimeData().
|
slot |
|
slot |
|
static |
|
slot |
remove an action form the editor
a | action to add |
menu | if not empty (and if QCE is built with qmdilib support) the action will be added to that menu |
toolbar | similar to menu but acts on toolbars |
|
slot |
Remove a placeholder.
i | placeholder index |
References clearCursorMirrors(), and QDocumentCursor::setAutoUpdated().
|
virtualslot |
Save the underlying document to a file.
References fileName(), flag(), isInConflict(), load(), QDocument::setClean(), setFileName(), QDocument::text(), and watcher().
Referenced by QStatusPanel::mousePressEvent().
|
slot |
Save the content of the editor to a file.
References fileName(), flag(), QDocument::setClean(), setFileName(), QDocument::text(), and watcher().
void QEditor::selectionChange | ( | bool | force = false | ) |
Does not do anything anymore...
Referenced by contextMenuEvent(), redo(), selectAll(), setCursor(), undo(), and write().
|
virtual |
If the current cursor does not have a selection, its cursorRect() is returned.
The returned rectangle will always be bigger than the actual selection has it is actually the union of all the rectangles occupied by all lines the selection spans over.
References cursorRect(), QDocumentCursor::hasSelection(), QDocument::lineRect(), QDocumentCursor::selection(), and QDocument::y().
Referenced by cursorRect().
|
slot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Referenced by setCodec(), and setDefaultCodec().
|
slot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References name(), and setCodec().
|
slot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References name(), and setCodec().
|
slot |
Set a code completion engine to the editor.
|
slot |
Notify that the content is clean (modifications undone or document saved)
References setContentModified().
|
virtualslot |
Notify that the content has been modified.
Referenced by setContentClean().
void QEditor::setCursorPosition | ( | int | line, |
int | index | ||
) |
Set the cursor.
line | document line to move the cursor to (start at zero) |
index | column index of the new cursor (start at zero) |
References setCursor().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
mib | codec identifier |
update | Update policy |
Referenced by QEditConfig::apply(), and setDefaultCodec().
|
static |
Set the default text codec.
c | codec to use |
update | Update policy |
The update policy determines whether existing editors are affected by the change of the default codec.
References codec(), and setCodec().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
name | name of the codec to use |
update | Update policy |
References name(), and setDefaultCodec().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
name | name of the codec to use |
update | Update policy |
References name(), and setDefaultCodec().
|
static |
Set the default editor flags.
Setting editor flags result in them being applied to ALL existing editors and editors to be created later on.
These can of course be modified on a per-editor basis later on.
References QDocument::clearWidthConstraint(), document(), and QDocument::setWidthConstraint().
Referenced by QEditConfig::apply().
|
static |
Set the default input binding.
|
static |
Set the default input binding.
|
virtualslot |
Changes the file name.
This method does not affect files on disk (no save/load/move occurs)
References fileName(), name(), setTitle(), and watcher().
|
slot |
Set line wrapping.
on | line wrap on/off |
References setFlag().
|
slot |
Change the viewport margins to make room for panels.
l | left margin |
t | top margin |
r | right margin |
b | bottom margin |
References flag(), and QDocument::setWidthConstraint().
|
slot |
Set the current placeholder to use.
This function change the cursor and the cursor mirrors.
References clearCursorMirrors(), and setCursor().
Referenced by nextPlaceHolder(), and previousPlaceHolder().
|
slot |
Set the title of the widget.
Take care of adding a "[*]" prefix so that document changes are visible on title bars.
Referenced by setFileName().
QString QEditor::text | ( | ) | const |
References QDocument::text().
Referenced by insertText(), and isProcessingKeyEvent().
QString QEditor::text | ( | int | line | ) | const |
line | text line to extract, using C++ array conventions (start at zero) |
References QDocument::line(), and QDocumentLine::text().
|
staticprotected |
The point of using a custom file watcher is to work around a bug (limitation) of QFileSystemWatcher which sometimes emit multiple signals for a single file save. It also enables to use a single object shared by all QEditor instances and reduce memory footprint.
Referenced by save(), setFileName(), and ~QEditor().
|
virtualslot |
Write some text at the current cursor position.
This function is provided to make editing operations easier from the outside and to keep them compatible with cursor mirrors.
References QDocument::beginMacro(), emitCursorPositionChanged(), QDocument::endMacro(), ensureCursorVisible(), insertText(), repaintCursor(), selectionChange(), and setFlag().
|
slot |
Zoom.
n | relative zoom factor |
Zooming is achieved by changing the point size of the font as follow :
fontPointSize += n
References QDocument::font(), and QDocument::setFont().