forked from qt-creator/qt-creator
TextEditor: Remove defaults from Format
The default caused strange bugs because it was expected that no color was set. Task-number: QTCREATORBUG-21282 Change-Id: I3b520b944ffcb87838ba3e7b02e1d28b0f757679 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -46,10 +46,6 @@ public:
|
|||||||
Format() = default;
|
Format() = default;
|
||||||
Format(const QColor &foreground, const QColor &background);
|
Format(const QColor &foreground, const QColor &background);
|
||||||
|
|
||||||
static Format createMixinFormat() {
|
|
||||||
return Format(QColor(), QColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor foreground() const { return m_foreground; }
|
QColor foreground() const { return m_foreground; }
|
||||||
void setForeground(const QColor &foreground);
|
void setForeground(const QColor &foreground);
|
||||||
|
|
||||||
@@ -86,8 +82,8 @@ public:
|
|||||||
bool fromString(const QString &str);
|
bool fromString(const QString &str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor m_foreground = Qt::black;
|
QColor m_foreground;
|
||||||
QColor m_background = Qt::white;
|
QColor m_background;
|
||||||
QColor m_underlineColor;
|
QColor m_underlineColor;
|
||||||
double m_relativeForegroundSaturation = 0.0;
|
double m_relativeForegroundSaturation = 0.0;
|
||||||
double m_relativeForegroundLightness = 0.0;
|
double m_relativeForegroundLightness = 0.0;
|
||||||
|
@@ -92,8 +92,10 @@ TextEditorSettings::TextEditorSettings()
|
|||||||
// Add font preference page
|
// Add font preference page
|
||||||
FormatDescriptions formatDescr;
|
FormatDescriptions formatDescr;
|
||||||
formatDescr.reserve(C_LAST_STYLE_SENTINEL);
|
formatDescr.reserve(C_LAST_STYLE_SENTINEL);
|
||||||
formatDescr.emplace_back(C_TEXT, tr("Text"), tr("Generic text and punctuation tokens.\n"
|
formatDescr.emplace_back(C_TEXT, tr("Text"),
|
||||||
"Applied to text that matched no other rule."));
|
tr("Generic text and punctuation tokens.\n"
|
||||||
|
"Applied to text that matched no other rule."),
|
||||||
|
Format{QColor{}, Qt::white});
|
||||||
|
|
||||||
// Special categories
|
// Special categories
|
||||||
const QPalette p = QApplication::palette();
|
const QPalette p = QApplication::palette();
|
||||||
@@ -168,7 +170,7 @@ TextEditorSettings::TextEditorSettings()
|
|||||||
functionFormat.setForeground(QColor(0, 103, 124));
|
functionFormat.setForeground(QColor(0, 103, 124));
|
||||||
formatDescr.emplace_back(C_FUNCTION, tr("Function"), tr("Name of a function."),
|
formatDescr.emplace_back(C_FUNCTION, tr("Function"), tr("Name of a function."),
|
||||||
functionFormat);
|
functionFormat);
|
||||||
Format declarationFormat = Format::createMixinFormat();
|
Format declarationFormat;
|
||||||
declarationFormat.setBold(true);
|
declarationFormat.setBold(true);
|
||||||
formatDescr.emplace_back(C_DECLARATION,
|
formatDescr.emplace_back(C_DECLARATION,
|
||||||
tr("Function Declaration"),
|
tr("Function Declaration"),
|
||||||
@@ -178,7 +180,6 @@ TextEditorSettings::TextEditorSettings()
|
|||||||
formatDescr.emplace_back(C_FUNCTION_DEFINITION,
|
formatDescr.emplace_back(C_FUNCTION_DEFINITION,
|
||||||
tr("Function Definition"),
|
tr("Function Definition"),
|
||||||
tr("Name of function at its definition."),
|
tr("Name of function at its definition."),
|
||||||
Format::createMixinFormat(),
|
|
||||||
FormatDescription::ShowAllControls);
|
FormatDescription::ShowAllControls);
|
||||||
Format virtualFunctionFormat(functionFormat);
|
Format virtualFunctionFormat(functionFormat);
|
||||||
virtualFunctionFormat.setItalic(true);
|
virtualFunctionFormat.setItalic(true);
|
||||||
@@ -242,7 +243,6 @@ TextEditorSettings::TextEditorSettings()
|
|||||||
formatDescr.emplace_back(C_OPERATOR, tr("Operator"),
|
formatDescr.emplace_back(C_OPERATOR, tr("Operator"),
|
||||||
tr("Non user-defined language operators.\n"
|
tr("Non user-defined language operators.\n"
|
||||||
"To style user-defined operators, use Overloaded Operator."),
|
"To style user-defined operators, use Overloaded Operator."),
|
||||||
Format::createMixinFormat(),
|
|
||||||
FormatDescription::ShowAllControls);
|
FormatDescription::ShowAllControls);
|
||||||
formatDescr.emplace_back(C_OVERLOADED_OPERATOR,
|
formatDescr.emplace_back(C_OVERLOADED_OPERATOR,
|
||||||
tr("Overloaded Operators"),
|
tr("Overloaded Operators"),
|
||||||
@@ -335,7 +335,7 @@ TextEditorSettings::TextEditorSettings()
|
|||||||
QColor(255, 190, 0),
|
QColor(255, 190, 0),
|
||||||
QTextCharFormat::DotLine,
|
QTextCharFormat::DotLine,
|
||||||
FormatDescription::ShowAllControls);
|
FormatDescription::ShowAllControls);
|
||||||
Format outputArgumentFormat = Format::createMixinFormat();
|
Format outputArgumentFormat;
|
||||||
outputArgumentFormat.setItalic(true);
|
outputArgumentFormat.setItalic(true);
|
||||||
formatDescr.emplace_back(C_OUTPUT_ARGUMENT,
|
formatDescr.emplace_back(C_OUTPUT_ARGUMENT,
|
||||||
tr("Output Argument"),
|
tr("Output Argument"),
|
||||||
|
Reference in New Issue
Block a user