mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Use qhelpers::adjustColumns in all widgets (#423)
This commit is contained in:
parent
459aaf482f
commit
c8fdf4b193
@ -2,6 +2,7 @@
|
||||
#include "ui_XrefsDialog.h"
|
||||
|
||||
#include "utils/TempConfig.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
@ -48,10 +49,7 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
|
||||
ui->fromTreeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
int count = ui->fromTreeWidget->columnCount();
|
||||
for (int i = 0; i != count; ++i) {
|
||||
ui->fromTreeWidget->resizeColumnToContents(i);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->fromTreeWidget, 0);
|
||||
|
||||
/* Fill Xrefs */
|
||||
ui->toTreeWidget->clear();
|
||||
@ -66,10 +64,7 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
|
||||
ui->toTreeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
int count2 = ui->toTreeWidget->columnCount();
|
||||
for (int i = 0; i != count2; ++i) {
|
||||
ui->toTreeWidget->resizeColumnToContents(i);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->toTreeWidget, 0);
|
||||
}
|
||||
|
||||
void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
|
@ -260,9 +260,7 @@ void ClassesWidget::refreshClasses()
|
||||
: CutterCore::getInstance()->getAllClassesFromFlags();
|
||||
model->endReload();
|
||||
|
||||
ui->classesTreeView->resizeColumnToContents(0);
|
||||
ui->classesTreeView->resizeColumnToContents(1);
|
||||
ui->classesTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->classesTreeView, 3, 0);
|
||||
|
||||
ui->classesTreeView->setColumnWidth(0, 200);
|
||||
}
|
||||
|
@ -151,9 +151,7 @@ void ExportsWidget::refreshExports()
|
||||
exports = CutterCore::getInstance()->getAllExports();
|
||||
exports_model->endReloadExports();
|
||||
|
||||
ui->exportsTreeView->resizeColumnToContents(0);
|
||||
ui->exportsTreeView->resizeColumnToContents(1);
|
||||
ui->exportsTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->exportsTreeView, 3, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,8 +227,7 @@ void FlagsWidget::refreshFlags()
|
||||
flags = CutterCore::getInstance()->getAllFlags(flagspace);
|
||||
flags_model->endReloadFlags();
|
||||
|
||||
ui->flagsTreeView->resizeColumnToContents(0);
|
||||
ui->flagsTreeView->resizeColumnToContents(1);
|
||||
qhelpers::adjustColumns(ui->flagsTreeView, 2, 0);
|
||||
|
||||
|
||||
// TODO: this is not a very good place for the following:
|
||||
|
@ -397,9 +397,7 @@ void FunctionsWidget::refreshTree()
|
||||
functionModel->endReloadFunctions();
|
||||
|
||||
// resize offset and size columns
|
||||
ui->functionsTreeView->resizeColumnToContents(0);
|
||||
ui->functionsTreeView->resizeColumnToContents(1);
|
||||
ui->functionsTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->functionsTreeView, 3, 0);
|
||||
}
|
||||
|
||||
void FunctionsWidget::onFunctionsDoubleClicked(const QModelIndex &index)
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "ui_SdbDock.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTreeWidget>
|
||||
@ -40,8 +41,7 @@ void SdbDock::reload(QString _path)
|
||||
Qt::ItemIsDragEnabled | Qt::ItemIsEditable);
|
||||
ui->treeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
ui->treeWidget->resizeColumnToContents(0);
|
||||
ui->treeWidget->resizeColumnToContents(1);
|
||||
qhelpers::adjustColumns(ui->treeWidget, 0);
|
||||
/* namespaces */
|
||||
keys = CutterCore::getInstance()->sdbList(path);
|
||||
keys.append("..");
|
||||
@ -51,8 +51,7 @@ void SdbDock::reload(QString _path)
|
||||
tempItem->setText(1, "");
|
||||
ui->treeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
ui->treeWidget->resizeColumnToContents(0);
|
||||
ui->treeWidget->resizeColumnToContents(1);
|
||||
qhelpers::adjustColumns(ui->treeWidget, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,9 +189,7 @@ void SearchWidget::refreshSearch()
|
||||
search = Core()->getAllSearch(search_for, searchspace);
|
||||
search_model->endReloadSearch();
|
||||
|
||||
ui->searchTreeView->resizeColumnToContents(0);
|
||||
ui->searchTreeView->resizeColumnToContents(1);
|
||||
ui->searchTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->searchTreeView, 3, 0);
|
||||
}
|
||||
|
||||
void SearchWidget::setScrollMode()
|
||||
|
@ -141,10 +141,7 @@ void SidebarWidget::fillRefs(QList<XrefDescription> refs, QList<XrefDescription>
|
||||
ui->xrefFromTreeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
int count = ui->xrefFromTreeWidget->columnCount();
|
||||
for (int i = 0; i != count; ++i) {
|
||||
ui->xrefFromTreeWidget->resizeColumnToContents(i);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->xrefFromTreeWidget, 0);
|
||||
|
||||
ui->xrefToTreeWidget->clear();
|
||||
for (int i = 0; i < xrefs.size(); ++i) {
|
||||
@ -163,10 +160,7 @@ void SidebarWidget::fillRefs(QList<XrefDescription> refs, QList<XrefDescription>
|
||||
ui->xrefToTreeWidget->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
int count2 = ui->xrefToTreeWidget->columnCount();
|
||||
for (int i = 0; i != count2; ++i) {
|
||||
ui->xrefToTreeWidget->resizeColumnToContents(i);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->xrefToTreeWidget, 0);
|
||||
}
|
||||
|
||||
void SidebarWidget::fillOffsetInfo(QString off)
|
||||
@ -187,10 +181,7 @@ void SidebarWidget::fillOffsetInfo(QString off)
|
||||
}
|
||||
|
||||
// Adjust column to contents
|
||||
int count = ui->offsetTreeWidget->columnCount();
|
||||
for (int i = 0; i != count; ++i) {
|
||||
ui->offsetTreeWidget->resizeColumnToContents(i);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->offsetTreeWidget, 0);
|
||||
|
||||
// Add opcode description
|
||||
QStringList description = Core()->cmd("?d. @ " + off).split(": ");
|
||||
|
@ -174,11 +174,7 @@ void StringsWidget::refreshStrings()
|
||||
strings = CutterCore::getInstance()->getAllStrings();
|
||||
model->endReload();
|
||||
|
||||
ui->stringsTreeView->resizeColumnToContents(0);
|
||||
ui->stringsTreeView->resizeColumnToContents(1);
|
||||
qhelpers::adjustColumns(ui->stringsTreeView, 5, 0);
|
||||
if (ui->stringsTreeView->columnWidth(1) > 300)
|
||||
ui->stringsTreeView->setColumnWidth(1, 300);
|
||||
ui->stringsTreeView->resizeColumnToContents(2);
|
||||
ui->stringsTreeView->resizeColumnToContents(3);
|
||||
ui->stringsTreeView->resizeColumnToContents(4);
|
||||
}
|
||||
|
@ -132,9 +132,7 @@ void TypesWidget::refreshTypes()
|
||||
types = CutterCore::getInstance()->getAllTypes();
|
||||
types_model->endReloadTypes();
|
||||
|
||||
ui->typesTreeView->resizeColumnToContents(0);
|
||||
ui->typesTreeView->resizeColumnToContents(1);
|
||||
ui->typesTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->typesTreeView, 3, 0);
|
||||
}
|
||||
|
||||
void TypesWidget::setScrollMode()
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
#include "VTablesWidget.h"
|
||||
#include "ui_VTablesWidget.h"
|
||||
|
||||
@ -173,9 +175,7 @@ void VTablesWidget::refreshVTables()
|
||||
vtables = CutterCore::getInstance()->getAllVTables();
|
||||
model->endReload();
|
||||
|
||||
ui->vTableTreeView->resizeColumnToContents(0);
|
||||
ui->vTableTreeView->resizeColumnToContents(1);
|
||||
ui->vTableTreeView->resizeColumnToContents(2);
|
||||
qhelpers::adjustColumns(ui->vTableTreeView, 3, 0);
|
||||
|
||||
ui->vTableTreeView->setColumnWidth(0, 200);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user