RelocsWidget: Change from QTableView to QTreeView (#439)

This commit is contained in:
Abdel-Rahman A 2018-04-12 08:33:03 +02:00 committed by xarkes
parent e1f17db235
commit 05fe4e60ea
3 changed files with 9 additions and 15 deletions

View File

@ -77,7 +77,7 @@ RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->relocsTableView->setModel(model); ui->relocsTreeView->setModel(model);
setScrollMode(); setScrollMode();
@ -86,7 +86,7 @@ RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
RelocsWidget::~RelocsWidget() {} RelocsWidget::~RelocsWidget() {}
void RelocsWidget::on_relocsTableView_doubleClicked(const QModelIndex &index) void RelocsWidget::on_relocsTreeView_doubleClicked(const QModelIndex &index)
{ {
Core()->seek(index.data(RelocsModel::AddressRole).toLongLong()); Core()->seek(index.data(RelocsModel::AddressRole).toLongLong());
} }
@ -96,10 +96,10 @@ void RelocsWidget::refreshRelocs()
model->beginReload(); model->beginReload();
relocs = Core()->getAllRelocs(); relocs = Core()->getAllRelocs();
model->endReload(); model->endReload();
ui->relocsTableView->resizeColumnsToContents(); qhelpers::adjustColumns(ui->relocsTreeView, 3, 0);
} }
void RelocsWidget::setScrollMode() void RelocsWidget::setScrollMode()
{ {
qhelpers::setVerticalScrollMode(ui->relocsTableView); qhelpers::setVerticalScrollMode(ui->relocsTreeView);
} }

View File

@ -45,7 +45,7 @@ public:
~RelocsWidget(); ~RelocsWidget();
private slots: private slots:
void on_relocsTableView_doubleClicked(const QModelIndex &index); void on_relocsTreeView_doubleClicked(const QModelIndex &index);
void refreshRelocs(); void refreshRelocs();
private: private:

View File

@ -28,9 +28,9 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="relocsTableView"> <widget class="QTreeView" name="relocsTreeView">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QTableView::item <string notr="true">QTreeView::item
{ {
padding-top: 1px; padding-top: 1px;
padding-bottom: 1px; padding-bottom: 1px;
@ -39,18 +39,12 @@
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="showGrid"> <property name="indentation">
<bool>false</bool> <number>8</number>
</property> </property>
<property name="sortingEnabled"> <property name="sortingEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget> </widget>
</item> </item>
</layout> </layout>