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);
// 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
QTextDocument *asm_docu = ui->previewTextEdit->document();
@ -212,14 +212,14 @@ QVariant XrefModel::data(const QModelIndex &index, int role) const
switch (index.column()) {
case OFFSET:
return to ? xref.from_str : xref.to_str;
case TYPE:
return xrefTypeString(xref.type);
case CODE:
if (to || xref.type != "DATA") {
return Core()->disassembleSingleInstruction(xref.from);
} else {
return QString();
}
case TYPE:
return xrefTypeString(xref.type);
}
return QVariant();
case FlagDescriptionRole:
@ -239,10 +239,10 @@ QVariant XrefModel::headerData(int section, Qt::Orientation orientation, int rol
switch (section) {
case OFFSET:
return tr("Address");
case CODE:
return tr("Code");
case TYPE:
return tr("Type");
case CODE:
return tr("Code");
default:
return QVariant();
}

View File

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

View File

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