Allow to change macro editor line highlight color in preferences

This commit is contained in:
Yorik van Havre 2012-03-18 01:53:04 -03:00
parent c0d21e6923
commit 5ca9ca1111
3 changed files with 11 additions and 4 deletions

View File

@ -115,6 +115,10 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
unsigned long lPyError = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
d->colormap.push_back(QPair<QString, unsigned long>
(QString::fromAscii(QT_TR_NOOP("Python error")), lPyError));
col.setRgb(224, 224, 224);
unsigned long lCLine = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
d->colormap.push_back(QPair<QString, unsigned long>
(QString::fromAscii(QT_TR_NOOP("Current line highlight")), lCLine));
QStringList labels; labels << tr("Items");
this->displayItems->setHeaderLabels(labels);

View File

@ -61,7 +61,7 @@ struct PythonEditorP
colormap[QLatin1String("Operator")] = QColor(160, 160, 164);
colormap[QLatin1String("Python output")] = QColor(170, 170, 127);
colormap[QLatin1String("Python error")] = Qt::red;
colormap[QLatin1String("Line")] = QColor(224,224,224);
colormap[QLatin1String("Current line highlight")] = QColor(224,224,224);
}
};
} // namespace Gui

View File

@ -192,7 +192,7 @@ struct TextEditorP
colormap[QLatin1String("Operator")] = QColor(160, 160, 164);
colormap[QLatin1String("Python output")] = QColor(170, 170, 127);
colormap[QLatin1String("Python error")] = Qt::red;
colormap[QLatin1String("Line")] = QColor(224,224,224);
colormap[QLatin1String("Current line highlight")] = QColor(224,224,224);
}
};
} // namespace Gui
@ -272,8 +272,11 @@ void TextEditor::highlightCurrentLine()
if (!isReadOnly()) {
QTextEdit::ExtraSelection selection;
QColor lineColor = d->colormap[QLatin1String("Line")];
QColor lineColor = d->colormap[QLatin1String("Current line highlight")];
unsigned long col = (lineColor.red() << 24) | (lineColor.green() << 16) | (lineColor.blue() << 8);
ParameterGrp::handle hPrefGrp = getWindowParameter();
col = hPrefGrp->GetUnsigned( "Current line highlight", col);
lineColor.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = textCursor();