QMessageBox: Use pmf-style connects
Port all string-based signal/slots connections to pmf-style connects. Change-Id: I7d77c2a10ed0c27422893403dfc9c5a6d43ea798 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit e5c40ec5c117376f401c01069f05780046d07094) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4fec40e67e
commit
9c83da5556
@ -98,8 +98,8 @@ public:
|
|||||||
layout->addWidget(textEdit);
|
layout->addWidget(textEdit);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
connect(textEdit, SIGNAL(copyAvailable(bool)),
|
connect(textEdit, &TextEdit::copyAvailable,
|
||||||
this, SLOT(textCopyAvailable(bool)));
|
this, &QMessageBoxDetailsText::textCopyAvailable);
|
||||||
}
|
}
|
||||||
void setText(const QString &text) { textEdit->setPlainText(text); }
|
void setText(const QString &text) { textEdit->setPlainText(text); }
|
||||||
QString text() const { return textEdit->toPlainText(); }
|
QString text() const { return textEdit->toPlainText(); }
|
||||||
@ -178,8 +178,8 @@ public:
|
|||||||
|
|
||||||
void init(const QString &title = QString(), const QString &text = QString());
|
void init(const QString &title = QString(), const QString &text = QString());
|
||||||
void setupLayout();
|
void setupLayout();
|
||||||
void _q_buttonClicked(QAbstractButton *);
|
void buttonClicked(QAbstractButton *);
|
||||||
void _q_helperClicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
|
void helperClicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
|
||||||
void setClickedButton(QAbstractButton *button);
|
void setClickedButton(QAbstractButton *button);
|
||||||
|
|
||||||
QAbstractButton *findButton(int button0, int button1, int button2, int flags);
|
QAbstractButton *findButton(int button0, int button1, int button2, int flags);
|
||||||
@ -257,8 +257,8 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
|
|||||||
buttonBox = new QDialogButtonBox;
|
buttonBox = new QDialogButtonBox;
|
||||||
buttonBox->setObjectName("qt_msgbox_buttonbox"_L1);
|
buttonBox->setObjectName("qt_msgbox_buttonbox"_L1);
|
||||||
buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q));
|
buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q));
|
||||||
QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton*)),
|
QObjectPrivate::connect(buttonBox, &QDialogButtonBox::clicked,
|
||||||
q, SLOT(_q_buttonClicked(QAbstractButton*)));
|
this, &QMessageBoxPrivate::buttonClicked);
|
||||||
setupLayout();
|
setupLayout();
|
||||||
if (!title.isEmpty() || !text.isEmpty()) {
|
if (!title.isEmpty() || !text.isEmpty()) {
|
||||||
q->setWindowTitle(title);
|
q->setWindowTitle(title);
|
||||||
@ -462,7 +462,7 @@ int QMessageBoxPrivate::dialogCode() const
|
|||||||
return QDialogPrivate::dialogCode();
|
return QDialogPrivate::dialogCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
|
void QMessageBoxPrivate::buttonClicked(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
Q_Q(QMessageBox);
|
Q_Q(QMessageBox);
|
||||||
#if QT_CONFIG(textedit)
|
#if QT_CONFIG(textedit)
|
||||||
@ -496,7 +496,7 @@ void QMessageBoxPrivate::setClickedButton(QAbstractButton *button)
|
|||||||
q->done(resultCode);
|
q->done(resultCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMessageBoxPrivate::_q_helperClicked(QPlatformDialogHelper::StandardButton helperButton, QPlatformDialogHelper::ButtonRole role)
|
void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton helperButton, QPlatformDialogHelper::ButtonRole role)
|
||||||
{
|
{
|
||||||
Q_UNUSED(role);
|
Q_UNUSED(role);
|
||||||
Q_Q(QMessageBox);
|
Q_Q(QMessageBox);
|
||||||
@ -511,7 +511,7 @@ void QMessageBoxPrivate::_q_helperClicked(QPlatformDialogHelper::StandardButton
|
|||||||
|
|
||||||
// Simulate click by explicitly clicking the button. This will ensure that
|
// Simulate click by explicitly clicking the button. This will ensure that
|
||||||
// any logic of the button that responds to the click is respected, including
|
// any logic of the button that responds to the click is respected, including
|
||||||
// plumbing back to _q_buttonClicked above based on the clicked() signal.
|
// plumbing back to buttonClicked above based on the clicked() signal.
|
||||||
dialogButton->click();
|
dialogButton->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2763,19 +2763,13 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
|
|||||||
|
|
||||||
void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
|
void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
|
||||||
{
|
{
|
||||||
Q_Q(QMessageBox);
|
|
||||||
QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)),
|
|
||||||
q, SLOT(_q_helperClicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)));
|
|
||||||
|
|
||||||
auto *messageDialogHelper = static_cast<QPlatformMessageDialogHelper *>(h);
|
auto *messageDialogHelper = static_cast<QPlatformMessageDialogHelper *>(h);
|
||||||
QObject::connect(messageDialogHelper, &QPlatformMessageDialogHelper::checkBoxStateChanged, q,
|
QObjectPrivate::connect(messageDialogHelper, &QPlatformMessageDialogHelper::clicked,
|
||||||
[this](Qt::CheckState state) {
|
this, &QMessageBoxPrivate::helperClicked);
|
||||||
if (checkbox)
|
QObject::connect(messageDialogHelper, &QPlatformMessageDialogHelper::checkBoxStateChanged,
|
||||||
checkbox->setCheckState(state);
|
checkbox, &QCheckBox::setCheckState);
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);
|
messageDialogHelper->setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMessageDialogOptions::StandardIcon helperIcon(QMessageBox::Icon i)
|
static QMessageDialogOptions::StandardIcon helperIcon(QMessageBox::Icon i)
|
||||||
|
@ -314,9 +314,6 @@ protected:
|
|||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *))
|
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_helperClicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole))
|
|
||||||
|
|
||||||
Q_DISABLE_COPY(QMessageBox)
|
Q_DISABLE_COPY(QMessageBox)
|
||||||
Q_DECLARE_PRIVATE(QMessageBox)
|
Q_DECLARE_PRIVATE(QMessageBox)
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user