fix: crash on windows if fixed font is missing

This commit is contained in:
sithlord48 2026-06-01 08:36:29 -04:00 committed by Nick Bolton
parent 80cc64c238
commit babef9c307

View file

@ -20,11 +20,18 @@ LogWidget::LogWidget(QWidget *parent) : QWidget{parent}, m_textLog{new QPlainTex
m_textLog->setLineWrapMode(QPlainTextEdit::NoWrap); m_textLog->setLineWrapMode(QPlainTextEdit::NoWrap);
// setup the log font // setup the log font
m_textLog->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); if (deskflow::platform::isWindows()) {
if (deskflow::platform::isMac()) { QFont f = font();
auto f = m_textLog->font(); f.setFamilies({"Hack", "Liberation Mono", "Monospace", "Andale Mono"});
f.setPixelSize(12); f.setStyleHint(QFont::Monospace);
m_textLog->setFont(f); 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; auto layout = new QVBoxLayout;