Change column oreder in xrefs (#2068)

This commit is contained in:
Itay Cohen 2020-02-28 10:37:07 +02:00 committed by GitHub
parent e38ff14bac
commit c93681649b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -25,7 +25,7 @@ XrefsDialog::XrefsDialog(MainWindow *main, QWidget *parent) :
ui->fromTreeWidget->setModel(&fromModel); ui->fromTreeWidget->setModel(&fromModel);
// Modify the splitter's location to show more Disassembly instead of empty space. Not possible via Designer // Modify the splitter's location to show more Disassembly instead of empty space. Not possible via Designer
ui->splitter->setSizes(QList<int>() << 100 << 200); ui->splitter->setSizes(QList<int>() << 300 << 400);
// Increase asm text edit margin // Increase asm text edit margin
QTextDocument *asm_docu = ui->previewTextEdit->document(); QTextDocument *asm_docu = ui->previewTextEdit->document();
@ -212,14 +212,14 @@ QVariant XrefModel::data(const QModelIndex &index, int role) const
switch (index.column()) { switch (index.column()) {
case OFFSET: case OFFSET:
return to ? xref.from_str : xref.to_str; return to ? xref.from_str : xref.to_str;
case TYPE:
return xrefTypeString(xref.type);
case CODE: case CODE:
if (to || xref.type != "DATA") { if (to || xref.type != "DATA") {
return Core()->disassembleSingleInstruction(xref.from); return Core()->disassembleSingleInstruction(xref.from);
} else { } else {
return QString(); return QString();
} }
case TYPE:
return xrefTypeString(xref.type);
} }
return QVariant(); return QVariant();
case FlagDescriptionRole: case FlagDescriptionRole:
@ -239,10 +239,10 @@ QVariant XrefModel::headerData(int section, Qt::Orientation orientation, int rol
switch (section) { switch (section) {
case OFFSET: case OFFSET:
return tr("Address"); return tr("Address");
case CODE:
return tr("Code");
case TYPE: case TYPE:
return tr("Type"); return tr("Type");
case CODE:
return tr("Code");
default: default:
return QVariant(); return QVariant();
} }

View File

@ -14,7 +14,7 @@ private:
QList<XrefDescription> xrefs; QList<XrefDescription> xrefs;
bool to; bool to;
public: public:
enum Columns { OFFSET = 0, CODE, TYPE, COUNT }; enum Columns { OFFSET = 0, TYPE, CODE, COUNT };
static const int FlagDescriptionRole = Qt::UserRole; static const int FlagDescriptionRole = Qt::UserRole;
XrefModel(QObject *parent = nullptr); XrefModel(QObject *parent = nullptr);

View File

@ -60,6 +60,9 @@
<property name="indentation"> <property name="indentation">
<number>5</number> <number>5</number>
</property> </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -80,6 +83,9 @@
<property name="indentation"> <property name="indentation">
<number>5</number> <number>5</number>
</property> </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>