diff --git a/fontdialog.cpp b/fontdialog.cpp index e470ef5..c44929e 100644 --- a/fontdialog.cpp +++ b/fontdialog.cpp @@ -182,7 +182,7 @@ void CFontDialog::updateColor(const QString color) } -CFont CFontDialog::getFont(const QString title, CFont defaultFont, bool needWeight, bool needItalic) +CFont CFontDialog::getFont(const QString title, CFont defaultFont, bool needWeight, bool needItalic, int *status) { CFontDialog dlg(0, needWeight, needItalic); @@ -202,11 +202,14 @@ CFont CFontDialog::getFont(const QString title, CFont defaultFont, bool needWeig dlg.italicBox->setCurrentIndex(0); CFont font = CFont(defaultFont); - if (dlg.exec() == 1) + int ret = dlg.exec(); + if (ret == 1) font = CFont(dlg.fontBox->currentFont().family(), dlg.sizeBox->value(), dlg.weightBox->value(), dlg.italicBox->currentIndex() == 1, QColor(dlg.colorBox->currentText())); + if (status != nullptr) + *status = ret; return font; } diff --git a/fontdialog.h b/fontdialog.h index f8e2cf7..3a16d4b 100644 --- a/fontdialog.h +++ b/fontdialog.h @@ -62,8 +62,9 @@ public: CFont defaultFont = CFont(QString("Arial"), 12, 400, false, QColor(QString("#000000"))), - const bool needWeight = true, - const bool needItalic = true); + const bool needWeight = true, + const bool needItalic = true, + int *status = nullptr); private slots: void updateColor(const QString color);