update fontdialog to track status

This commit is contained in:
Evgenii Alekseev 2016-04-19 16:14:29 +03:00
parent ef47b1146e
commit e7bcf8ee85
2 changed files with 8 additions and 4 deletions

View File

@ -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); CFontDialog dlg(0, needWeight, needItalic);
@ -202,11 +202,14 @@ CFont CFontDialog::getFont(const QString title, CFont defaultFont, bool needWeig
dlg.italicBox->setCurrentIndex(0); dlg.italicBox->setCurrentIndex(0);
CFont font = CFont(defaultFont); CFont font = CFont(defaultFont);
if (dlg.exec() == 1) int ret = dlg.exec();
if (ret == 1)
font = CFont(dlg.fontBox->currentFont().family(), font = CFont(dlg.fontBox->currentFont().family(),
dlg.sizeBox->value(), dlg.sizeBox->value(),
dlg.weightBox->value(), dlg.weightBox->value(),
dlg.italicBox->currentIndex() == 1, dlg.italicBox->currentIndex() == 1,
QColor(dlg.colorBox->currentText())); QColor(dlg.colorBox->currentText()));
if (status != nullptr)
*status = ret;
return font; return font;
} }

View File

@ -63,7 +63,8 @@ public:
12, 400, false, 12, 400, false,
QColor(QString("#000000"))), QColor(QString("#000000"))),
const bool needWeight = true, const bool needWeight = true,
const bool needItalic = true); const bool needItalic = true,
int *status = nullptr);
private slots: private slots:
void updateColor(const QString color); void updateColor(const QString color);