Merge pull request #6557 from spycrab/qt_log_font

Qt/LogWidget: Add "Debugger Font" option
This commit is contained in:
Léo Lam 2018-03-29 15:12:33 +02:00 committed by GitHub
commit e4f2ff0f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -40,6 +40,8 @@ LogWidget::LogWidget(QWidget* parent) : QDockWidget(parent), m_timer(new QTimer(
connect(m_timer, &QTimer::timeout, this, &LogWidget::UpdateLog); connect(m_timer, &QTimer::timeout, this, &LogWidget::UpdateLog);
m_timer->start(UPDATE_LOG_DELAY); m_timer->start(UPDATE_LOG_DELAY);
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &LogWidget::UpdateFont);
LogManager::GetInstance()->RegisterListener(LogListener::LOG_WINDOW_LISTENER, this); LogManager::GetInstance()->RegisterListener(LogListener::LOG_WINDOW_LISTENER, this);
} }
@ -97,6 +99,9 @@ void LogWidget::UpdateFont()
f = QFont(QStringLiteral("Monospace")); f = QFont(QStringLiteral("Monospace"));
f.setStyleHint(QFont::TypeWriter); f.setStyleHint(QFont::TypeWriter);
break; break;
case 2: // Debugger font
f = Settings::Instance().GetDebugFont();
break;
} }
m_log_text->setFont(f); m_log_text->setFont(f);
} }
@ -110,7 +115,7 @@ void LogWidget::CreateWidgets()
m_log_font = new QComboBox; m_log_font = new QComboBox;
m_log_clear = new QPushButton(tr("Clear")); m_log_clear = new QPushButton(tr("Clear"));
m_log_font->addItems({tr("Default Font"), tr("Monospaced Font")}); m_log_font->addItems({tr("Default Font"), tr("Monospaced Font"), tr("Selected Font")});
auto* log_layout = new QGridLayout; auto* log_layout = new QGridLayout;
m_tab_log->setLayout(log_layout); m_tab_log->setLayout(log_layout);