mirror of
https://github.com/arcan1s/qtadds-fontdialog.git
synced 2025-04-24 08:37:17 +00:00
update fontdialog to track status
This commit is contained in:
parent
ef47b1146e
commit
e7bcf8ee85
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user