From c47dd737b0e5ab5ea8b4d695fe237df52890d643 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 20 Jan 2015 08:50:49 +0100 Subject: [PATCH] BaseTreeView: Modernize connections Change-Id: Ie8de8a5c59f16a22419d1ee8382ef151a65d0b07 Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller --- src/libs/utils/basetreeview.cpp | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index 98adaf01194..29ba0590f21 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -124,7 +124,7 @@ public: } } - Q_SLOT void handleSectionResized(int logicalIndex, int /*oldSize*/, int newSize) + void handleSectionResized(int logicalIndex, int /*oldSize*/, int newSize) { if (m_expectUserChanges) { m_userHandled[logicalIndex] = newSize; @@ -159,7 +159,7 @@ public: return minimum; } - Q_SLOT void resizeColumns() + Q_SLOT void resizeColumns() // Needs moc, see BaseTreeView::setModel { QHeaderView *h = q->header(); QTC_ASSERT(h, return); @@ -178,17 +178,7 @@ public: } } - Q_SLOT void rowActivatedHelper(const QModelIndex &index) - { - q->rowActivated(index); - } - - Q_SLOT void rowClickedHelper(const QModelIndex &index) - { - q->rowClicked(index); - } - - Q_SLOT void toggleColumnWidth(int logicalIndex) + void toggleColumnWidth(int logicalIndex) { QHeaderView *h = q->header(); const int currentSize = h->sectionSize(logicalIndex); @@ -254,14 +244,15 @@ BaseTreeView::BaseTreeView(QWidget *parent) h->setSectionsClickable(true); h->viewport()->installEventFilter(d); - connect(this, SIGNAL(activated(QModelIndex)), - d, SLOT(rowActivatedHelper(QModelIndex))); - connect(this, SIGNAL(clicked(QModelIndex)), - d, SLOT(rowClickedHelper(QModelIndex))); - connect(h, SIGNAL(sectionClicked(int)), - d, SLOT(toggleColumnWidth(int))); - connect(h, SIGNAL(sectionResized(int,int,int)), - d, SLOT(handleSectionResized(int,int,int))); + connect(this, &QAbstractItemView::activated, + this, &BaseTreeView::rowActivated); + connect(this, &QAbstractItemView::clicked, + this, &BaseTreeView::rowClicked); + + connect(h, &QHeaderView::sectionClicked, + d, &BaseTreeViewPrivate::toggleColumnWidth); + connect(h, &QHeaderView::sectionResized, + d, &BaseTreeViewPrivate::handleSectionResized); } BaseTreeView::~BaseTreeView()