Commit 00bf7b28 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Modernize code: Replace remaining private slots with lambdas

parent 63567db4
Pipeline #52857 canceled with stage
...@@ -114,7 +114,7 @@ private: ...@@ -114,7 +114,7 @@ private:
} }
private: private:
QPointer<QAbstractItemView> lastView; QSet<QAbstractItemView *> connectedViews;
QString customLabelText; QString customLabelText;
Options options; Options options;
...@@ -417,20 +417,13 @@ void CertificateSelectionDialog::filterAllowedKeys(std::vector<Key> &keys, int o ...@@ -417,20 +417,13 @@ void CertificateSelectionDialog::filterAllowedKeys(std::vector<Key> &keys, int o
void CertificateSelectionDialog::Private::slotCurrentViewChanged(QAbstractItemView *newView) void CertificateSelectionDialog::Private::slotCurrentViewChanged(QAbstractItemView *newView)
{ {
if (lastView) { if (!connectedViews.contains(newView)) {
disconnect(lastView, SIGNAL(doubleClicked(QModelIndex)), connectedViews.insert(newView);
q, SLOT(slotDoubleClicked(QModelIndex))); connect(newView, &QAbstractItemView::doubleClicked,
Q_ASSERT(lastView->selectionModel()); q, [this] (const QModelIndex &index) { slotDoubleClicked(index); });
disconnect(lastView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
q, SLOT(slotSelectionChanged()));
}
lastView = newView;
if (newView) {
connect(newView, SIGNAL(doubleClicked(QModelIndex)),
q, SLOT(slotDoubleClicked(QModelIndex)));
Q_ASSERT(newView->selectionModel()); Q_ASSERT(newView->selectionModel());
connect(newView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), connect(newView->selectionModel(), &QItemSelectionModel::selectionChanged,
q, SLOT(slotSelectionChanged())); q, [this] (const QItemSelection &, const QItemSelection &) { slotSelectionChanged(); });
} }
slotSelectionChanged(); slotSelectionChanged();
} }
......
...@@ -88,8 +88,6 @@ protected: ...@@ -88,8 +88,6 @@ protected:
private: private:
class Private; class Private;
kdtools::pimpl_ptr<Private> d; kdtools::pimpl_ptr<Private> d;
Q_PRIVATE_SLOT(d, void slotSelectionChanged())
Q_PRIVATE_SLOT(d, void slotDoubleClicked(QModelIndex))
}; };
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment