Skip to content

Commit 1a5e227

Browse files
committed
Fix Monospace font lookup
1 parent 31cc2ad commit 1a5e227

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

qrtranslations/fr/qrutils_fr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442
<context>
443443
<name>qReal::ui::ConsoleDock</name>
444444
<message>
445-
<location filename="../../qrutils/widgets/consoleDock.cpp" line="+50"/>
445+
<location filename="../../qrutils/widgets/consoleDock.cpp" line="+54"/>
446446
<source>Reset shell</source>
447447
<translation type="unfinished"></translation>
448448
</message>

qrtranslations/ru/qrutils_ru.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@
554554
<context>
555555
<name>qReal::ui::ConsoleDock</name>
556556
<message>
557-
<location filename="../../qrutils/widgets/consoleDock.cpp" line="+50"/>
557+
<location filename="../../qrutils/widgets/consoleDock.cpp" line="+54"/>
558558
<source>Reset shell</source>
559559
<translation>Очистить консоль</translation>
560560
</message>

qrutils/widgets/consoleDock.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ConsoleDock::ConsoleDock(const QString &title, QWidget *parent)
3030
: QDockWidget(title, parent)
3131
, mOutput(new QPlainTextEdit(this))
3232
{
33-
QFont font("Monospace");
33+
QFont font("");
3434
font.setStyleHint(QFont::Monospace);
3535
bool ok;
3636
auto size = qReal::SettingsManager::value("CustomDockTextSize").toInt(&ok);
@@ -40,7 +40,11 @@ ConsoleDock::ConsoleDock(const QString &title, QWidget *parent)
4040

4141
mOutput->setFont(font);
4242
if (!QFontInfo(mOutput->font()).fixedPitch()) {
43-
QLOG_ERROR() << "Not monospaced font was choosen " << font.toString();
43+
const auto &font1 = mOutput->font().toString();
44+
font.setStyleHint(QFont::TypeWriter);
45+
mOutput->setFont(font);
46+
const auto &font2 = mOutput->font().toString();
47+
QLOG_ERROR() << "Not monospaced font was choosen (" << font1 << "), trying to fallback to" << font2;
4448
}
4549
setWidget(mOutput);
4650
mOutput->setReadOnly(false);

0 commit comments

Comments
 (0)