From d6a44b289027db999e50a2b346327e6650a4f43c Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 1 Feb 2018 01:33:50 +0100 Subject: Modernize OriginDialog Use type safe connect syntax and remove one Q_FOREACH makro. Make the reject button a non-member, but keep the OK button. I thought about gettring rid of the latter, too, but deactivating OK when no match is the most sensible way to go... --- origindialog.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'origindialog.cpp') diff --git a/origindialog.cpp b/origindialog.cpp index f885132..c2f5835 100644 --- a/origindialog.cpp +++ b/origindialog.cpp @@ -64,13 +64,13 @@ void OriginDialog::setupGui(){ dstLayout->addWidget(mDstMd5, 3, 1); destGB->setLayout(dstLayout); mOk = new QPushButton(tr("Add")); - connect(mOk, SIGNAL(clicked()), this, SLOT(accept())); - mCancel = new QPushButton(tr("Cancel")); - connect(mCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(mOk, &QPushButton::clicked, this, &OriginDialog::accept); + QPushButton *cancelB = new QPushButton(tr("Cancel")); + connect(cancelB, &QPushButton::clicked, this, &OriginDialog::reject); QHBoxLayout *btnLayout = new QHBoxLayout; btnLayout->addStretch(); btnLayout->addWidget(mOk); - btnLayout->addWidget(mCancel); + btnLayout->addWidget(cancelB); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(origGB); mainLayout->addWidget(destGB); @@ -142,7 +142,7 @@ void OriginDialog::setDstData(const QString &absolutefn){ } void OriginDialog::clear(){ - foreach(QLineEdit *le, mLineEdits){ + for(QLineEdit *le : mLineEdits){ le->clear(); } } -- cgit v1.2.3-70-g09d2