Don't use hack to make the first column movable

PR #16545.
This commit is contained in:
thalieht 2022-03-01 06:50:10 +02:00 committed by GitHub
parent 98bdfcef65
commit 63812ca951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 58 deletions

View file

@ -40,7 +40,6 @@
#include <QShortcut>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QTableView>
#include <QVector>
#include <QWheelEvent>
@ -89,6 +88,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
setAllColumnsShowFocus(true);
setEditTriggers(QAbstractItemView::NoEditTriggers);
setSelectionMode(QAbstractItemView::ExtendedSelection);
header()->setFirstSectionMovable(true);
header()->setStretchLastSection(false);
header()->setTextElideMode(Qt::ElideRight);
@ -163,13 +163,6 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
handleSortColumnChanged(header()->sortIndicatorSection());
const auto *copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut);
connect(copyHotkey, &QShortcut::activated, this, &PeerListWidget::copySelectedPeers);
// This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused;
unused.setVerticalHeader(this->header());
this->header()->setParent(this);
unused.setVerticalHeader(new QHeaderView(Qt::Horizontal));
}
PeerListWidget::~PeerListWidget()