forked from qt-creator/qt-creator
TextEditor: Move SnippetsEditor to new editor construction scheme
Change-Id: I10612d86b6a634e7370c1a29507f709132f4e54b Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -31,10 +31,11 @@
|
||||
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFocusEvent>
|
||||
|
||||
using namespace TextEditor;
|
||||
namespace TextEditor {
|
||||
|
||||
/*!
|
||||
\class TextEditor::SnippetEditorWidget
|
||||
@@ -45,15 +46,15 @@ using namespace TextEditor;
|
||||
|
||||
SnippetEditor::SnippetEditor()
|
||||
{
|
||||
setContext(Core::Context(Constants::SNIPPET_EDITOR_ID, Constants::C_TEXTEDITOR));
|
||||
addContext(Constants::SNIPPET_EDITOR_ID);
|
||||
setEditorCreator([]() { return new SnippetEditor; });
|
||||
setWidgetCreator([]() { return new SnippetEditorWidget; });
|
||||
setDocumentCreator([]() { return new BaseTextDocument(Constants::SNIPPET_EDITOR_ID); });
|
||||
}
|
||||
|
||||
SnippetEditorWidget::SnippetEditorWidget(QWidget *parent)
|
||||
: BaseTextEditorWidget(parent)
|
||||
{
|
||||
BaseTextDocumentPtr doc(new BaseTextDocument);
|
||||
doc->setId(Constants::SNIPPET_EDITOR_ID);
|
||||
setTextDocument(doc);
|
||||
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
||||
setHighlightCurrentLine(false);
|
||||
setLineNumbersVisible(false);
|
||||
@@ -76,5 +77,7 @@ void SnippetEditorWidget::focusOutEvent(QFocusEvent *event)
|
||||
|
||||
BaseTextEditor *SnippetEditorWidget::createEditor()
|
||||
{
|
||||
return new SnippetEditor;
|
||||
QTC_ASSERT("should not happen anymore" && false, return 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -47,8 +47,6 @@ class TEXTEDITOR_EXPORT SnippetEditor : public BaseTextEditor
|
||||
|
||||
public:
|
||||
SnippetEditor();
|
||||
|
||||
Core::IEditor *duplicate() { return 0; }
|
||||
};
|
||||
|
||||
class TEXTEDITOR_EXPORT SnippetEditorWidget : public BaseTextEditorWidget
|
||||
@@ -56,7 +54,7 @@ class TEXTEDITOR_EXPORT SnippetEditorWidget : public BaseTextEditorWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SnippetEditorWidget(QWidget *parent);
|
||||
SnippetEditorWidget(QWidget *parent = 0);
|
||||
|
||||
void setSyntaxHighlighter(SyntaxHighlighter *highlighter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user