From abd4e00ee6a4a812290330ea8b47dd4c518717cb Mon Sep 17 00:00:00 2001 From: cetc32-ck Date: Tue, 22 Feb 2022 15:18:21 +0800 Subject: [PATCH] Fix list-view sort indicator not update issue. --- .../controls/directory-view/view/list-view/list-view.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpeony-qt/controls/directory-view/view/list-view/list-view.cpp b/libpeony-qt/controls/directory-view/view/list-view/list-view.cpp index 1a75e132..ddbe9f89 100644 --- a/libpeony-qt/controls/directory-view/view/list-view/list-view.cpp +++ b/libpeony-qt/controls/directory-view/view/list-view/list-view.cpp @@ -101,6 +101,14 @@ ListView::ListView(QWidget *parent) : QTreeView(parent) setMouseTracking(true);//追踪鼠标 m_rubberBand = new QRubberBand(QRubberBand::Shape::Rectangle, this); + + //fix head indication sort type and order not change in preference file issue + connect(header(), &QHeaderView::sortIndicatorChanged, this, [=](int logicalIndex, Qt::SortOrder order) + { + //qDebug() << "sortIndicatorChanged:" <setValue(SORT_COLUMN, logicalIndex); + Peony::GlobalSettings::getInstance()->setValue(SORT_ORDER, order); + }); } void ListView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint)