Skip to content

Commit 21ba05a

Browse files
committed
GUI: save the sorting preference of the user for the session
1 parent 92da0ef commit 21ba05a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

x64_dbg_gui/Project/Src/BasicView/StdTable.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,19 @@ void StdTable::contextMenuRequestedSlot(const QPoint & pos)
422422

423423
void StdTable::headerButtonPressedSlot(int col)
424424
{
425-
if(mSort.first != -1)
425+
if(mSort.first != col) //first = column to sort
426426
{
427427
mSort.first = col;
428-
mSort.second = false;
428+
mSort.second = false; //second = ascending/descending
429429
}
430430
else
431431
mSort.second = !mSort.second;
432-
qSort(mData.begin(), mData.end(), ColumnCompare(col, mSort.second));
433432
reloadData();
434433
}
434+
435+
void StdTable::reloadData()
436+
{
437+
if(mSort.first != -1) //re-sort if the user wants to sort
438+
qSort(mData.begin(), mData.end(), ColumnCompare(mSort.first, mSort.second));
439+
AbstractTableView::reloadData();
440+
}

x64_dbg_gui/Project/Src/BasicView/StdTable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class StdTable : public AbstractTableView
99
public:
1010
explicit StdTable(QWidget* parent = 0);
1111
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
12+
void reloadData();
1213

1314
void mouseMoveEvent(QMouseEvent* event);
1415
void mousePressEvent(QMouseEvent* event);

0 commit comments

Comments
 (0)