fix: crash on windows if fixed font is missing
This commit is contained in:
parent
80cc64c238
commit
babef9c307
1 changed files with 11 additions and 4 deletions
|
|
@ -20,11 +20,18 @@ LogWidget::LogWidget(QWidget *parent) : QWidget{parent}, m_textLog{new QPlainTex
|
|||
m_textLog->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
|
||||
// setup the log font
|
||||
m_textLog->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
if (deskflow::platform::isMac()) {
|
||||
auto f = m_textLog->font();
|
||||
f.setPixelSize(12);
|
||||
if (deskflow::platform::isWindows()) {
|
||||
QFont f = font();
|
||||
f.setFamilies({"Hack", "Liberation Mono", "Monospace", "Andale Mono"});
|
||||
f.setStyleHint(QFont::Monospace);
|
||||
m_textLog->setFont(f);
|
||||
} else {
|
||||
m_textLog->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
if (deskflow::platform::isMac()) {
|
||||
auto f = m_textLog->font();
|
||||
f.setPixelSize(12);
|
||||
m_textLog->setFont(f);
|
||||
}
|
||||
}
|
||||
|
||||
auto layout = new QVBoxLayout;
|
||||
|
|
|
|||
Loading…
Reference in a new issue