QFontDialog: Use pmf-style connects
Port all string-based signal/slots connections to pmf-style connects. Change-Id: Ic7ecfd1efb8eb76239598e48f25251357040f814 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit fb58a3aabe8ff9956560dea64c91cd8727da839d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9c83da5556
commit
f433e57e53
@ -208,14 +208,21 @@ void QFontDialogPrivate::init()
|
|||||||
size = 0;
|
size = 0;
|
||||||
smoothScalable = false;
|
smoothScalable = false;
|
||||||
|
|
||||||
QObject::connect(writingSystemCombo, SIGNAL(activated(int)), q, SLOT(_q_writingSystemHighlighted(int)));
|
QObjectPrivate::connect(writingSystemCombo, &QComboBox::activated,
|
||||||
QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int)));
|
this, &QFontDialogPrivate::writingSystemHighlighted);
|
||||||
QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int)));
|
QObjectPrivate::connect(familyList, &QFontListView::highlighted,
|
||||||
QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int)));
|
this, &QFontDialogPrivate::familyHighlighted);
|
||||||
QObject::connect(sizeEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_sizeChanged(QString)));
|
QObjectPrivate::connect(styleList, &QFontListView::highlighted,
|
||||||
|
this, &QFontDialogPrivate::styleHighlighted);
|
||||||
|
QObjectPrivate::connect(sizeList, &QFontListView::highlighted,
|
||||||
|
this, &QFontDialogPrivate::sizeHighlighted);
|
||||||
|
QObjectPrivate::connect(sizeEdit, &QLineEdit::textChanged,
|
||||||
|
this, &QFontDialogPrivate::sizeChanged);
|
||||||
|
|
||||||
QObject::connect(strikeout, SIGNAL(clicked()), q, SLOT(_q_updateSample()));
|
QObjectPrivate::connect(strikeout, &QCheckBox::clicked,
|
||||||
QObject::connect(underline, SIGNAL(clicked()), q, SLOT(_q_updateSample()));
|
this, &QFontDialogPrivate::updateSample);
|
||||||
|
QObjectPrivate::connect(underline, &QCheckBox::clicked, this,
|
||||||
|
&QFontDialogPrivate::updateSample);
|
||||||
|
|
||||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
||||||
QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i);
|
QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i);
|
||||||
@ -277,11 +284,11 @@ void QFontDialogPrivate::init()
|
|||||||
|
|
||||||
QPushButton *button
|
QPushButton *button
|
||||||
= static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok));
|
= static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok));
|
||||||
QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
|
QObject::connect(buttonBox, &QDialogButtonBox::accepted, q, &QDialog::accept);
|
||||||
button->setDefault(true);
|
button->setDefault(true);
|
||||||
|
|
||||||
buttonBox->addButton(QDialogButtonBox::Cancel);
|
buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
|
QObject::connect(buttonBox, &QDialogButtonBox::rejected, q, &QDialog::reject);
|
||||||
|
|
||||||
q->resize(500, 360);
|
q->resize(500, 360);
|
||||||
|
|
||||||
@ -430,8 +437,10 @@ void QFontDialogPrivate::initHelper(QPlatformDialogHelper *h)
|
|||||||
auto *fontDialogHelper = static_cast<QPlatformFontDialogHelper *>(h);
|
auto *fontDialogHelper = static_cast<QPlatformFontDialogHelper *>(h);
|
||||||
fontDialogHelper->setOptions(options);
|
fontDialogHelper->setOptions(options);
|
||||||
fontDialogHelper->setCurrentFont(q->currentFont());
|
fontDialogHelper->setCurrentFont(q->currentFont());
|
||||||
QObject::connect(h, SIGNAL(currentFontChanged(QFont)), q, SIGNAL(currentFontChanged(QFont)));
|
QObject::connect(fontDialogHelper, &QPlatformFontDialogHelper::currentFontChanged,
|
||||||
QObject::connect(h, SIGNAL(fontSelected(QFont)), q, SIGNAL(fontSelected(QFont)));
|
q, &QFontDialog::currentFontChanged);
|
||||||
|
QObject::connect(fontDialogHelper, &QPlatformFontDialogHelper::fontSelected,
|
||||||
|
q, &QFontDialog::fontSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
|
void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
|
||||||
@ -622,10 +631,10 @@ void QFontDialogPrivate::updateSizes()
|
|||||||
sizeEdit->clear();
|
sizeEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
_q_updateSample();
|
updateSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFontDialogPrivate::_q_updateSample()
|
void QFontDialogPrivate::updateSample()
|
||||||
{
|
{
|
||||||
// compute new font
|
// compute new font
|
||||||
int pSize = sizeEdit->text().toInt();
|
int pSize = sizeEdit->text().toInt();
|
||||||
@ -651,7 +660,7 @@ void QFontDialogPrivate::updateSampleFont(const QFont &newFont)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
void QFontDialogPrivate::_q_writingSystemHighlighted(int index)
|
void QFontDialogPrivate::writingSystemHighlighted(int index)
|
||||||
{
|
{
|
||||||
writingSystem = QFontDatabase::WritingSystem(index);
|
writingSystem = QFontDatabase::WritingSystem(index);
|
||||||
sampleEdit->setText(QFontDatabase::writingSystemSample(writingSystem));
|
sampleEdit->setText(QFontDatabase::writingSystemSample(writingSystem));
|
||||||
@ -661,7 +670,7 @@ void QFontDialogPrivate::_q_writingSystemHighlighted(int index)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
void QFontDialogPrivate::_q_familyHighlighted(int i)
|
void QFontDialogPrivate::familyHighlighted(int i)
|
||||||
{
|
{
|
||||||
Q_Q(QFontDialog);
|
Q_Q(QFontDialog);
|
||||||
family = familyList->text(i);
|
family = familyList->text(i);
|
||||||
@ -678,7 +687,7 @@ void QFontDialogPrivate::_q_familyHighlighted(int i)
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void QFontDialogPrivate::_q_styleHighlighted(int index)
|
void QFontDialogPrivate::styleHighlighted(int index)
|
||||||
{
|
{
|
||||||
Q_Q(QFontDialog);
|
Q_Q(QFontDialog);
|
||||||
QString s = styleList->text(index);
|
QString s = styleList->text(index);
|
||||||
@ -697,7 +706,7 @@ void QFontDialogPrivate::_q_styleHighlighted(int index)
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void QFontDialogPrivate::_q_sizeHighlighted(int index)
|
void QFontDialogPrivate::sizeHighlighted(int index)
|
||||||
{
|
{
|
||||||
Q_Q(QFontDialog);
|
Q_Q(QFontDialog);
|
||||||
QString s = sizeList->text(index);
|
QString s = sizeList->text(index);
|
||||||
@ -707,7 +716,7 @@ void QFontDialogPrivate::_q_sizeHighlighted(int index)
|
|||||||
sizeEdit->selectAll();
|
sizeEdit->selectAll();
|
||||||
|
|
||||||
size = s.toInt();
|
size = s.toInt();
|
||||||
_q_updateSample();
|
updateSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -716,7 +725,7 @@ void QFontDialogPrivate::_q_sizeHighlighted(int index)
|
|||||||
The size is passed in the \a s argument as a \e string.
|
The size is passed in the \a s argument as a \e string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void QFontDialogPrivate::_q_sizeChanged(const QString &s)
|
void QFontDialogPrivate::sizeChanged(const QString &s)
|
||||||
{
|
{
|
||||||
// no need to check if the conversion is valid, since we have an QIntValidator in the size edit
|
// no need to check if the conversion is valid, since we have an QIntValidator in the size edit
|
||||||
int size = s.toInt();
|
int size = s.toInt();
|
||||||
@ -736,7 +745,7 @@ void QFontDialogPrivate::_q_sizeChanged(const QString &s)
|
|||||||
else
|
else
|
||||||
sizeList->clearSelection();
|
sizeList->clearSelection();
|
||||||
}
|
}
|
||||||
_q_updateSample();
|
updateSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFontDialogPrivate::retranslateStrings()
|
void QFontDialogPrivate::retranslateStrings()
|
||||||
|
@ -70,13 +70,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QFontDialog)
|
Q_DISABLE_COPY(QFontDialog)
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_sizeChanged(const QString &))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_familyHighlighted(int))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_writingSystemHighlighted(int))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_updateSample())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
|
||||||
|
@ -57,12 +57,12 @@ public:
|
|||||||
const QString &title, QFontDialog::FontDialogOptions options);
|
const QString &title, QFontDialog::FontDialogOptions options);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void _q_sizeChanged(const QString &);
|
void sizeChanged(const QString &);
|
||||||
void _q_familyHighlighted(int);
|
void familyHighlighted(int);
|
||||||
void _q_writingSystemHighlighted(int);
|
void writingSystemHighlighted(int);
|
||||||
void _q_styleHighlighted(int);
|
void styleHighlighted(int);
|
||||||
void _q_sizeHighlighted(int);
|
void sizeHighlighted(int);
|
||||||
void _q_updateSample();
|
void updateSample();
|
||||||
void updateSampleFont(const QFont &newFont);
|
void updateSampleFont(const QFont &newFont);
|
||||||
void retranslateStrings();
|
void retranslateStrings();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user