diff options
| author | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-04-17 12:09:57 +0200 |
|---|---|---|
| committer | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-04-17 20:50:24 +0200 |
| commit | 487770e422e4c55e128c210bb82b30ed99f3f401 (patch) | |
| tree | 2827f7ec704ea06cc4de858eaf56f4ce68a8b35c /objects/texteditor.cpp | |
| parent | e793225595a8010d35506011ac2a915df8e21119 (diff) | |
Introduced the class TextEditor
This is to make it similar in heirarchy as the IEditor subclasses.
This commit also wraps QPoint and QRect so they are usable from the scripts
Change-Id: I214a7323cf6cc20cb9df509d0ea0515358248714
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'objects/texteditor.cpp')
| -rw-r--r-- | objects/texteditor.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/objects/texteditor.cpp b/objects/texteditor.cpp new file mode 100644 index 0000000..e919802 --- /dev/null +++ b/objects/texteditor.cpp @@ -0,0 +1,75 @@ +#include "texteditor.h" + +namespace Scripting { +namespace Internal { + +TextEditor::TextEditor(QObject *parent) : + Editor(parent) +{ +} + +int TextEditor::find(const QString &string) const +{ + // Doesn't seem to do much. + return editor()->find(string); +} + +int TextEditor::position(Enums::PositionOperation posOp, int at) const +{ + return editor()->position( static_cast< ::TextEditor::ITextEditor::PositionOperation>(posOp), at); +} + +QPoint TextEditor::convertPosition(int pos) const +{ + int line, column; + editor()->convertPosition(pos,&line,&column); + return QPoint(column,line); +} + +QRect TextEditor::cursorRect(int pos) const +{ + return editor()->cursorRect(pos); +} + +int TextEditor::columnCount() const +{ + return editor()->columnCount(); +} + +int TextEditor::rowCount() const +{ + return editor()->rowCount(); +} + +void TextEditor::remove(int length) +{ + editor()->remove(length); +} + +void TextEditor::insert(const QString &string) +{ + editor()->insert(string); +} + +void TextEditor::replace(int length, const QString &string) +{ + editor()->replace(length, string); +} + +void TextEditor::setCursorPosition(int pos) +{ + editor()->setCursorPosition(pos); +} + +void TextEditor::select(int toPos) +{ + editor()->select(toPos); +} + +::TextEditor::ITextEditor *TextEditor::editor() const +{ + return qobject_cast< ::TextEditor::ITextEditor*>(Editor::editor()); +} + +} // namespace Internal +} // namespace Scripting |
