mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Fix sorting resources by index, vaddr and size (#2308)
* Fix sorting resources by index, vaddr and size
This commit is contained in:
parent
00595da5ab
commit
73f99c696f
@ -1,5 +1,6 @@
|
||||
#include "common/Helpers.h"
|
||||
#include "ResourcesWidget.h"
|
||||
#include "ui_ListDockWidget.h"
|
||||
#include "core/MainWindow.h"
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@ -41,6 +42,23 @@ QVariant ResourcesModel::data(const QModelIndex &index, int role) const
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::EditRole:
|
||||
switch (index.column()) {
|
||||
case NAME:
|
||||
return res.name;
|
||||
case VADDR:
|
||||
return res.vaddr;
|
||||
case INDEX:
|
||||
return res.index;
|
||||
case TYPE:
|
||||
return res.type;
|
||||
case SIZE:
|
||||
return res.size;
|
||||
case LANG:
|
||||
return res.lang;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::UserRole:
|
||||
return QVariant::fromValue(res);
|
||||
default:
|
||||
@ -86,8 +104,11 @@ ResourcesWidget::ResourcesWidget(MainWindow *main) :
|
||||
|
||||
model = new ResourcesModel(&resources, this);
|
||||
filterModel = new AddressableFilterProxyModel(model, this);
|
||||
filterModel->setSortRole(Qt::EditRole);
|
||||
setModels(filterModel);
|
||||
|
||||
ui->treeView->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
showCount(false);
|
||||
|
||||
// Configure widget
|
||||
|
Loading…
Reference in New Issue
Block a user