Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
25e4655d
Commit
25e4655d
authored
14 years ago
by
Leandro Melo
Browse files
Options
Downloads
Patches
Plain Diff
Generic highlighter: Apply format only if it's a configured one; Remove hard-coded colors.
Reviewed-by: con
parent
88ba37f8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/texteditor/generichighlighter/highlighter.cpp
+25
-22
25 additions, 22 deletions
src/plugins/texteditor/generichighlighter/highlighter.cpp
src/plugins/texteditor/plaintexteditor.cpp
+0
-14
0 additions, 14 deletions
src/plugins/texteditor/plaintexteditor.cpp
with
25 additions
and
36 deletions
src/plugins/texteditor/generichighlighter/highlighter.cpp
+
25
−
22
View file @
25e4655d
...
@@ -382,29 +382,32 @@ void Highlighter::applyFormat(int offset,
...
@@ -382,29 +382,32 @@ void Highlighter::applyFormat(int offset,
TextFormatId
formatId
=
m_kateFormats
.
m_ids
.
value
(
itemData
->
style
());
TextFormatId
formatId
=
m_kateFormats
.
m_ids
.
value
(
itemData
->
style
());
if
(
formatId
!=
Normal
)
{
if
(
formatId
!=
Normal
)
{
QTextCharFormat
format
=
m_creatorFormats
.
value
(
formatId
);
QHash
<
TextFormatId
,
QTextCharFormat
>::
const_iterator
cit
=
m_creatorFormats
.
constFind
(
formatId
);
if
(
itemData
->
isCustomized
())
{
if
(
cit
!=
m_creatorFormats
.
constEnd
())
{
// Please notice that the following are applied every time for item datas which have
QTextCharFormat
format
=
cit
.
value
();
// customizations. The configureFormats method could be used to provide a "one time"
if
(
itemData
->
isCustomized
())
{
// configuration, but it would probably require to traverse all item datas from all
// Please notice that the following are applied every time for item datas which have
// definitions available/loaded (either to set the values or for some "notifying"
// customizations. The configureFormats method could be used to provide a "one time"
// strategy). This is because the highlighter does not really know on which
// configuration, but it would probably require to traverse all item datas from all
// definition(s) it is working. Since not many item datas specify customizations I
// definitions available/loaded (either to set the values or for some "notifying"
// think this approach would fit better. If there are other ideas...
// strategy). This is because the highlighter does not really know on which
if
(
itemData
->
color
().
isValid
())
// definition(s) it is working. Since not many item datas specify customizations I
format
.
setForeground
(
itemData
->
color
());
// think this approach would fit better. If there are other ideas...
if
(
itemData
->
isItalicSpecified
())
if
(
itemData
->
color
().
isValid
())
format
.
setFontItalic
(
itemData
->
isItalic
());
format
.
setForeground
(
itemData
->
color
());
if
(
itemData
->
isBoldSpecified
())
if
(
itemData
->
isItalicSpecified
())
format
.
setFontWeight
(
toFontWeight
(
itemData
->
isBold
()));
format
.
setFontItalic
(
itemData
->
isItalic
());
if
(
itemData
->
isUnderlinedSpecified
())
if
(
itemData
->
isBoldSpecified
())
format
.
setFontUnderline
(
itemData
->
isUnderlined
());
format
.
setFontWeight
(
toFontWeight
(
itemData
->
isBold
()));
if
(
itemData
->
isStrikedOutSpecified
())
if
(
itemData
->
isUnderlinedSpecified
())
format
.
setFontStrikeOut
(
itemData
->
isStrikedOut
());
format
.
setFontUnderline
(
itemData
->
isUnderlined
());
}
if
(
itemData
->
isStrikedOutSpecified
())
format
.
setFontStrikeOut
(
itemData
->
isStrikedOut
());
}
setFormat
(
offset
,
count
,
format
);
setFormat
(
offset
,
count
,
format
);
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/plugins/texteditor/plaintexteditor.cpp
+
0
−
14
View file @
25e4655d
...
@@ -134,20 +134,6 @@ void PlainTextEditor::setFontSettings(const FontSettings &fs)
...
@@ -134,20 +134,6 @@ void PlainTextEditor::setFontSettings(const FontSettings &fs)
highlighter
->
configureFormat
(
Highlighter
::
String
,
fs
.
toTextCharFormat
(
highlighter
->
configureFormat
(
Highlighter
::
String
,
fs
.
toTextCharFormat
(
QLatin1String
(
Constants
::
C_STRING
)));
QLatin1String
(
Constants
::
C_STRING
)));
// Creator does not have corresponding formats for the following ones. Implement them?
// For now I will leave hardcoded values.
QTextCharFormat
format
;
format
.
setForeground
(
Qt
::
blue
);
highlighter
->
configureFormat
(
Highlighter
::
Others
,
format
);
format
.
setForeground
(
Qt
::
red
);
highlighter
->
configureFormat
(
Highlighter
::
Alert
,
format
);
format
.
setForeground
(
Qt
::
darkBlue
);
highlighter
->
configureFormat
(
Highlighter
::
Function
,
format
);
format
.
setForeground
(
Qt
::
darkGray
);
highlighter
->
configureFormat
(
Highlighter
::
RegionMarker
,
format
);
format
.
setForeground
(
Qt
::
darkRed
);
highlighter
->
configureFormat
(
Highlighter
::
Error
,
format
);
highlighter
->
rehighlight
();
highlighter
->
rehighlight
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment