mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
Add color lines button
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
@ -60,6 +60,14 @@ void LogView::setWordWrap(bool wrapping)
|
||||
}
|
||||
}
|
||||
|
||||
void LogView::setColorLines(bool colorLines)
|
||||
{
|
||||
if (m_colorLines == colorLines)
|
||||
return;
|
||||
m_colorLines = colorLines;
|
||||
repopulate();
|
||||
}
|
||||
|
||||
void LogView::setModel(QAbstractItemModel* model)
|
||||
{
|
||||
if (m_model) {
|
||||
@ -130,11 +138,11 @@ void LogView::rowsInserted(const QModelIndex& parent, int first, int last)
|
||||
format.setFont(font.value<QFont>());
|
||||
}
|
||||
auto fg = m_model->data(idx, Qt::ForegroundRole);
|
||||
if (fg.isValid()) {
|
||||
if (fg.isValid() && m_colorLines) {
|
||||
format.setForeground(fg.value<QColor>());
|
||||
}
|
||||
auto bg = m_model->data(idx, Qt::BackgroundRole);
|
||||
if (bg.isValid()) {
|
||||
if (bg.isValid() && m_colorLines) {
|
||||
format.setBackground(bg.value<QColor>());
|
||||
}
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
|
@ -15,6 +15,7 @@ class LogView : public QPlainTextEdit {
|
||||
|
||||
public slots:
|
||||
void setWordWrap(bool wrapping);
|
||||
void setColorLines(bool colorLines);
|
||||
void findNext(const QString& what, bool reverse);
|
||||
void scrollToBottom();
|
||||
|
||||
@ -32,4 +33,5 @@ class LogView : public QPlainTextEdit {
|
||||
QTextCharFormat* m_defaultFormat = nullptr;
|
||||
bool m_scroll = false;
|
||||
bool m_scrolling = false;
|
||||
bool m_colorLines = true;
|
||||
};
|
||||
|
Reference in New Issue
Block a user