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);
@ -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;
}

View File

@ -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);