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
Marco Bubke
flatpak-qt-creator
Commits
649559ad
Commit
649559ad
authored
Aug 09, 2010
by
Roberto Raggi
Browse files
Store the QTextCharFormat used to mark virtual methods.
parent
cdf9d03e
Changes
3
Show whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
649559ad
...
...
@@ -988,9 +988,6 @@ void CPPEditor::highlightTypeUsages(int from, int to)
Q_ASSERT
(
!
chunks
.
isEmpty
());
QTextBlock
b
=
doc
->
findBlockByNumber
(
m_nextHighlightBlockNumber
);
QTextCharFormat
virtualMethodFormat
;
// ### hardcoded;
virtualMethodFormat
.
setFontItalic
(
true
);
QMapIterator
<
int
,
QVector
<
SemanticInfo
::
Use
>
>
it
(
chunks
);
while
(
b
.
isValid
()
&&
it
.
hasNext
())
{
it
.
next
();
...
...
@@ -1021,7 +1018,7 @@ void CPPEditor::highlightTypeUsages(int from, int to)
break
;
case
SemanticInfo
::
Use
::
VirtualMethod
:
formatRange
.
format
=
virtualMethodFormat
;
formatRange
.
format
=
m_
virtualMethodFormat
;
break
;
default:
...
...
@@ -1746,6 +1743,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
m_fieldFormat
=
fs
.
toTextCharFormat
(
QLatin1String
(
TextEditor
::
Constants
::
C_FIELD
));
m_keywordFormat
=
fs
.
toTextCharFormat
(
QLatin1String
(
TextEditor
::
Constants
::
C_KEYWORD
));
m_virtualMethodFormat
.
setFontItalic
(
true
);
// ### hardcoded
// only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link
m_occurrencesFormat
.
clearForeground
();
m_occurrenceRenameFormat
.
clearForeground
();
...
...
src/plugins/cppeditor/cppeditor.h
View file @
649559ad
...
...
@@ -291,6 +291,7 @@ private:
QTextCharFormat
m_localFormat
;
QTextCharFormat
m_fieldFormat
;
QTextCharFormat
m_keywordFormat
;
QTextCharFormat
m_virtualMethodFormat
;
QList
<
QTextEdit
::
ExtraSelection
>
m_renameSelections
;
int
m_currentRenameSelection
;
...
...
src/plugins/texteditor/syntaxhighlighter.cpp
View file @
649559ad
...
...
@@ -665,21 +665,6 @@ QTextBlock SyntaxHighlighter::currentBlock() const
return
d
->
currentBlock
;
}
static
bool
isSimilarCharFormat
(
const
QTextCharFormat
&
format
,
const
QTextCharFormat
&
other
)
{
if
(
format
.
foreground
()
!=
other
.
foreground
())
return
false
;
else
if
(
format
.
background
()
!=
other
.
background
())
return
false
;
else
if
(
format
.
underlineStyle
()
!=
other
.
underlineStyle
())
return
false
;
else
if
(
format
.
underlineColor
()
!=
other
.
underlineColor
())
return
false
;
else
if
(
format
.
font
()
!=
other
.
font
())
return
false
;
return
true
;
}
void
SyntaxHighlighter
::
setExtraAdditionalFormats
(
const
QTextBlock
&
block
,
const
QList
<
QTextLayout
::
FormatRange
>
&
formats
)
{
...
...
@@ -706,7 +691,7 @@ void SyntaxHighlighter::setExtraAdditionalFormats(const QTextBlock& block,
if
(
skip
<
formats
.
size
()
&&
it
->
start
==
formats
.
at
(
skip
).
start
&&
it
->
length
==
formats
.
at
(
skip
).
length
&&
isSimilarCharFormat
(
it
->
format
,
formats
.
at
(
skip
).
format
)
)
{
&&
it
->
format
==
formats
.
at
(
skip
).
format
)
{
++
skip
;
++
it
;
}
else
{
...
...
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