[skip ci] make font fixed for Qt below than 5.2

This commit is contained in:
Syping 2020-08-25 15:32:32 +02:00
parent af86e70f4b
commit 23245a3324
1 changed files with 5 additions and 0 deletions

View File

@ -70,6 +70,11 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
#if QT_VERSION >= 0x050200
ui->txtJSON->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
#else
QFont jsonFont = ui->txtJSON->font();
jsonFont.setStyleHint(QFont::Monospace);
jsonFont.setFixedPitch(true);
ui->txtJSON->setFont(jsonFont);
#endif
QFontMetrics fontMetrics(ui->txtJSON->font());
ui->txtJSON->setTabStopWidth(fontMetrics.width(" "));