QtWidgets: code tidies: use the 4-arg connect overload
The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I4e518dd4a9733cc0a42b02639cce9c6136ad5afc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
df735d794f
commit
9e87c3e958
@ -1755,7 +1755,7 @@ void QColorDialogPrivate::initWidgets()
|
||||
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
|
||||
q->connect(custom, SIGNAL(currentChanged(int,int)), SLOT(_q_nextCustom(int,int)));
|
||||
|
||||
q->connect(custom, &QWellArray::colorChanged, [this] (int index, QRgb color) {
|
||||
q->connect(custom, &QWellArray::colorChanged, q, [this] (int index, QRgb color) {
|
||||
QColorDialogOptions::setCustomColor(index, color);
|
||||
if (custom)
|
||||
custom->update();
|
||||
|
@ -2325,7 +2325,7 @@ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::funct
|
||||
fileOpenCompleted(fileName, fileContent);
|
||||
};
|
||||
|
||||
connect(dialog, &QFileDialog::fileSelected, fileSelected);
|
||||
connect(dialog, &QFileDialog::fileSelected, dialog, fileSelected);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
#endif
|
||||
@ -2365,7 +2365,7 @@ void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString &
|
||||
}
|
||||
};
|
||||
|
||||
connect(dialog, &QFileDialog::fileSelected, fileSelected);
|
||||
connect(dialog, &QFileDialog::fileSelected, dialog, fileSelected);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
#endif
|
||||
|
@ -20,7 +20,7 @@ void QKeySequenceEditPrivate::init()
|
||||
lineEdit = new QLineEdit(q);
|
||||
lineEdit->setObjectName(QStringLiteral("qt_keysequenceedit_lineedit"));
|
||||
lineEdit->setClearButtonEnabled(false);
|
||||
q->connect(lineEdit, &QLineEdit::textChanged, [q](const QString& text) {
|
||||
q->connect(lineEdit, &QLineEdit::textChanged, q, [q](const QString& text) {
|
||||
// Clear the shortcut if the user clicked on the clear icon
|
||||
if (text.isEmpty())
|
||||
q->clear();
|
||||
|
@ -165,7 +165,7 @@ void QMenuPrivate::init()
|
||||
defaultMenuAction = menuAction = new QAction(q);
|
||||
menuAction->setMenu(q); // this calls setOverrideMenuAction
|
||||
setOverrideMenuAction(nullptr);
|
||||
QObject::connect(menuAction, &QAction::changed, [this] {
|
||||
QObject::connect(menuAction, &QAction::changed, q, [this] {
|
||||
if (!tornPopup.isNull())
|
||||
tornPopup->updateWindowTitle();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user