mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Resources Widget name/double click fix
This commit is contained in:
parent
0c035f7ad8
commit
c8e6cae150
@ -1216,7 +1216,7 @@ QList<ResourcesDescription> CutterCore::getAllResources()
|
||||
QJsonObject resourceObject = value.toObject();
|
||||
|
||||
ResourcesDescription res;
|
||||
res.name = resourceObject["name"].toString();
|
||||
res.name = resourceObject["name"].toInt();
|
||||
res.vaddr = resourceObject["vaddr"].toVariant().toULongLong();
|
||||
res.index = resourceObject["index"].toVariant().toULongLong();
|
||||
res.type = resourceObject["type"].toString();
|
||||
|
@ -197,7 +197,7 @@ struct ClassDescription
|
||||
|
||||
struct ResourcesDescription
|
||||
{
|
||||
QString name;
|
||||
int name;
|
||||
RVA vaddr;
|
||||
ut64 index;
|
||||
QString type;
|
||||
@ -220,10 +220,10 @@ Q_DECLARE_METATYPE(RBinPluginDescription)
|
||||
Q_DECLARE_METATYPE(ClassMethodDescription)
|
||||
Q_DECLARE_METATYPE(ClassFieldDescription)
|
||||
Q_DECLARE_METATYPE(ClassDescription)
|
||||
Q_DECLARE_METATYPE(ResourcesDescription)
|
||||
Q_DECLARE_METATYPE(const ClassDescription *)
|
||||
Q_DECLARE_METATYPE(const ClassMethodDescription *)
|
||||
Q_DECLARE_METATYPE(const ClassFieldDescription *)
|
||||
Q_DECLARE_METATYPE(ResourcesDescription)
|
||||
|
||||
class CutterCore: public QObject
|
||||
{
|
||||
|
@ -20,27 +20,30 @@ int ResourcesModel::columnCount(const QModelIndex &) const
|
||||
|
||||
QVariant ResourcesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const ResourcesDescription *res = &resources->at(index.row());
|
||||
const ResourcesDescription &res = resources->at(index.row());
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column())
|
||||
{
|
||||
case NAME:
|
||||
return res->name;
|
||||
return res.name;
|
||||
case VADDR:
|
||||
return RAddressString(res->vaddr);
|
||||
return RAddressString(res.vaddr);
|
||||
case INDEX:
|
||||
return res->index;
|
||||
return res.index;
|
||||
case TYPE:
|
||||
return res->type;
|
||||
return res.type;
|
||||
case SIZE:
|
||||
return qhelpers::formatBytecount(res->size);
|
||||
return qhelpers::formatBytecount(res.size);
|
||||
case LANG:
|
||||
return res->lang;
|
||||
return res.lang;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::UserRole:
|
||||
return QVariant::fromValue(res);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -110,6 +113,6 @@ void ResourcesWidget::refreshResources()
|
||||
|
||||
void ResourcesWidget::onDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
ResourcesDescription res = index.data().value<ResourcesDescription>();
|
||||
ResourcesDescription res = index.data(Qt::UserRole).value<ResourcesDescription>();
|
||||
CutterCore::getInstance()->seek(res.vaddr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user