forked from qt-creator/qt-creator
TextEditor: Fix highlighting for mixins
The color from mix-ins should be always override the previous color. It should only be tested for relative colors. It looks like the branches was mixed up. Change-Id: I9b8602ab65cab65f0df8ec2c111845cf2d8d33cf Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -228,21 +228,23 @@ void FontSettings::addMixinStyle(QTextCharFormat &textCharFormat,
|
||||
for (TextStyle mixinStyle : mixinStyles) {
|
||||
const Format &format = m_scheme.formatFor(mixinStyle);
|
||||
|
||||
if (textCharFormat.hasProperty(QTextFormat::ForegroundBrush)) {
|
||||
if (format.foreground().isValid())
|
||||
textCharFormat.setForeground(format.foreground());
|
||||
else
|
||||
if (format.foreground().isValid()) {
|
||||
textCharFormat.setForeground(format.foreground());
|
||||
} else {
|
||||
if (textCharFormat.hasProperty(QTextFormat::ForegroundBrush)) {
|
||||
textCharFormat.setForeground(mixBrush(textCharFormat.foreground(),
|
||||
format.relativeForegroundSaturation(),
|
||||
format.relativeForegroundLightness()));
|
||||
}
|
||||
}
|
||||
if (textCharFormat.hasProperty(QTextFormat::BackgroundBrush)) {
|
||||
if (format.background().isValid())
|
||||
textCharFormat.setBackground(format.background());
|
||||
else
|
||||
if (format.background().isValid()) {
|
||||
textCharFormat.setBackground(format.background());
|
||||
} else {
|
||||
if (textCharFormat.hasProperty(QTextFormat::BackgroundBrush)) {
|
||||
textCharFormat.setBackground(mixBrush(textCharFormat.background(),
|
||||
format.relativeBackgroundSaturation(),
|
||||
format.relativeBackgroundLightness()));
|
||||
}
|
||||
}
|
||||
if (!textCharFormat.fontItalic())
|
||||
textCharFormat.setFontItalic(format.italic());
|
||||
|
||||
Reference in New Issue
Block a user