Skip to content

Commit

Permalink
Merge a9f1fd1 into 6486b33
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton authored Dec 28, 2020
2 parents 6486b33 + a9f1fd1 commit 0b399c2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Editors/FontEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ FontEditor::FontEditor(MessageModel *model, QWidget *parent) : BaseEditor(model,
_ui->setupUi(this);
connect(_ui->saveButton, &QAbstractButton::pressed, this, &BaseEditor::OnSave);

_font = _ui->fontComboBox->currentFont();

_ui->fontPreviewText->setFont(_font);

_ui->fontPreviewText->setText(
"abcdefghijklmnopqrstuvwxyz\n\
ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\
Expand All @@ -25,6 +21,18 @@ The quick brown fox jumps over the lazy dog.");
_resMapper->addMapping(_ui->italicCheckBox, Font::kItalicFieldNumber);

RebindSubModels();

// build the initial font out of the mapped properties
_font = _ui->fontComboBox->currentFont();
// QFontComboBox does not have a default USER property
// so we have to use its QComboBox one to actually get font
_font.setFamily(_ui->fontComboBox->currentText());
_font.setPointSize(_ui->sizeSpinBox->value());
_font.setBold(_ui->boldCheckBox->isChecked());
_font.setItalic(_ui->italicCheckBox->isChecked());
// set the initial font on the preview area
_ui->fontPreviewText->setFont(_font);
_ui->rangePreviewText->setFont(_font);
}

FontEditor::~FontEditor() { delete _ui; }
Expand Down

0 comments on commit 0b399c2

Please sign in to comment.