forked from qt-creator/qt-creator
BaseTreeView: Modernize connections
Change-Id: Ie8de8a5c59f16a22419d1ee8382ef151a65d0b07 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -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) {
|
if (m_expectUserChanges) {
|
||||||
m_userHandled[logicalIndex] = newSize;
|
m_userHandled[logicalIndex] = newSize;
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
return minimum;
|
return minimum;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SLOT void resizeColumns()
|
Q_SLOT void resizeColumns() // Needs moc, see BaseTreeView::setModel
|
||||||
{
|
{
|
||||||
QHeaderView *h = q->header();
|
QHeaderView *h = q->header();
|
||||||
QTC_ASSERT(h, return);
|
QTC_ASSERT(h, return);
|
||||||
@@ -178,17 +178,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SLOT void rowActivatedHelper(const QModelIndex &index)
|
void toggleColumnWidth(int logicalIndex)
|
||||||
{
|
|
||||||
q->rowActivated(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_SLOT void rowClickedHelper(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
q->rowClicked(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_SLOT void toggleColumnWidth(int logicalIndex)
|
|
||||||
{
|
{
|
||||||
QHeaderView *h = q->header();
|
QHeaderView *h = q->header();
|
||||||
const int currentSize = h->sectionSize(logicalIndex);
|
const int currentSize = h->sectionSize(logicalIndex);
|
||||||
@@ -254,14 +244,15 @@ BaseTreeView::BaseTreeView(QWidget *parent)
|
|||||||
h->setSectionsClickable(true);
|
h->setSectionsClickable(true);
|
||||||
h->viewport()->installEventFilter(d);
|
h->viewport()->installEventFilter(d);
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, &QAbstractItemView::activated,
|
||||||
d, SLOT(rowActivatedHelper(QModelIndex)));
|
this, &BaseTreeView::rowActivated);
|
||||||
connect(this, SIGNAL(clicked(QModelIndex)),
|
connect(this, &QAbstractItemView::clicked,
|
||||||
d, SLOT(rowClickedHelper(QModelIndex)));
|
this, &BaseTreeView::rowClicked);
|
||||||
connect(h, SIGNAL(sectionClicked(int)),
|
|
||||||
d, SLOT(toggleColumnWidth(int)));
|
connect(h, &QHeaderView::sectionClicked,
|
||||||
connect(h, SIGNAL(sectionResized(int,int,int)),
|
d, &BaseTreeViewPrivate::toggleColumnWidth);
|
||||||
d, SLOT(handleSectionResized(int,int,int)));
|
connect(h, &QHeaderView::sectionResized,
|
||||||
|
d, &BaseTreeViewPrivate::handleSectionResized);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseTreeView::~BaseTreeView()
|
BaseTreeView::~BaseTreeView()
|
||||||
|
Reference in New Issue
Block a user