Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
de527d06
Commit
de527d06
authored
Nov 08, 2010
by
Leandro Melo
Browse files
Snippets: Set indenters.
parent
920967d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppsnippeteditordecorator.cpp
View file @
de527d06
...
...
@@ -30,6 +30,7 @@
#include "cppsnippeteditordecorator.h"
#include "cpphighlighter.h"
#include "cppeditor.h"
#include "cppqtstyleindenter.h"
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
...
...
@@ -61,4 +62,6 @@ void CppSnippetEditorDecorator::apply(TextEditor::SnippetEditor *editor) const
fs
.
toTextCharFormats
(
CPPEditor
::
highlighterFormatCategories
());
highlighter
->
setFormats
(
formats
.
constBegin
(),
formats
.
constEnd
());
editor
->
installSyntaxHighlighter
(
highlighter
);
editor
->
setIndenter
(
new
CppQtStyleIndenter
);
}
src/plugins/qmljseditor/qmljssnippeteditordecorator.cpp
View file @
de527d06
...
...
@@ -30,6 +30,7 @@
#include "qmljssnippeteditordecorator.h"
#include "qmljshighlighter.h"
#include "qmljseditor.h"
#include "qmljsindenter.h"
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
...
...
@@ -59,4 +60,6 @@ void QmlJSSnippetEditorDecorator::apply(TextEditor::SnippetEditor *editor) const
const
TextEditor
::
FontSettings
&
fs
=
TextEditor
::
TextEditorSettings
::
instance
()
->
fontSettings
();
highlighter
->
setFormats
(
fs
.
toTextCharFormats
(
QmlJSTextEditor
::
highlighterFormatCategories
()));
editor
->
installSyntaxHighlighter
(
highlighter
);
editor
->
setIndenter
(
new
Indenter
);
}
src/plugins/texteditor/snippets/snippeteditor.cpp
View file @
de527d06
...
...
@@ -50,12 +50,9 @@ QString SnippetEditorEditable::id() const
return
Constants
::
SNIPPET_EDITOR_ID
;
}
SnippetEditor
::
SnippetEditor
(
QWidget
*
parent
)
:
BaseTextEditor
(
parent
),
m_indenter
(
new
NormalIndenter
)
SnippetEditor
::
SnippetEditor
(
QWidget
*
parent
)
:
BaseTextEditor
(
parent
)
{
setFrameStyle
(
QFrame
::
StyledPanel
|
QFrame
::
Sunken
);
setHighlightCurrentLine
(
false
);
setLineNumbersVisible
(
false
);
}
...
...
@@ -68,11 +65,6 @@ void SnippetEditor::installSyntaxHighlighter(TextEditor::SyntaxHighlighter *high
baseTextDocument
()
->
setSyntaxHighlighter
(
highlighter
);
}
void
SnippetEditor
::
installIndenter
(
Indenter
*
indenter
)
{
m_indenter
.
reset
(
indenter
);
}
void
SnippetEditor
::
focusOutEvent
(
QFocusEvent
*
event
)
{
Q_UNUSED
(
event
);
...
...
@@ -84,9 +76,3 @@ BaseTextEditorEditable *SnippetEditor::createEditableInterface()
{
return
new
SnippetEditorEditable
(
this
);
}
void
SnippetEditor
::
indentBlock
(
QTextDocument
*
doc
,
QTextBlock
block
,
QChar
typedChar
)
{
if
(
!
m_indenter
.
isNull
())
m_indenter
->
indentBlock
(
doc
,
block
,
typedChar
,
tabSettings
());
}
src/plugins/texteditor/snippets/snippeteditor.h
View file @
de527d06
...
...
@@ -71,7 +71,6 @@ public:
virtual
~
SnippetEditor
();
void
installSyntaxHighlighter
(
SyntaxHighlighter
*
highlighter
);
void
installIndenter
(
Indenter
*
indenter
);
signals:
void
snippetContentChanged
();
...
...
@@ -81,10 +80,6 @@ protected:
virtual
int
extraAreaWidth
(
int
*
/* markWidthPtr */
=
0
)
const
{
return
0
;
}
virtual
BaseTextEditorEditable
*
createEditableInterface
();
virtual
void
indentBlock
(
QTextDocument
*
doc
,
QTextBlock
block
,
QChar
typedChar
);
private:
QScopedPointer
<
Indenter
>
m_indenter
;
};
}
// TextEditor
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment