mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Check QModelIndex/column before processing double click event (#450)
This commit is contained in:
parent
09bfc9f3d0
commit
0ae021f9a1
@ -267,6 +267,9 @@ void ClassesWidget::refreshClasses()
|
||||
|
||||
void ClassesWidget::on_classesTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
RVA offset = index.data(ClassesModel::OffsetRole).value<RVA>();
|
||||
Core()->seek(offset);
|
||||
}
|
||||
|
@ -35,15 +35,21 @@ CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
|
||||
|
||||
CommentsWidget::~CommentsWidget() {}
|
||||
|
||||
void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int)
|
||||
void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
|
||||
Core()->seek(comment.offset);
|
||||
}
|
||||
|
||||
void CommentsWidget::on_nestedCmtsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int)
|
||||
void CommentsWidget::on_nestedCmtsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
// don't react on top-level items
|
||||
if (item->parent() == nullptr) {
|
||||
return;
|
||||
|
@ -45,8 +45,11 @@ void EntrypointWidget::setScrollMode()
|
||||
}
|
||||
|
||||
void EntrypointWidget::on_entrypointTreeWidget_itemDoubleClicked(QTreeWidgetItem *item,
|
||||
int /* column */)
|
||||
int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
EntrypointDescription ep = item->data(0, Qt::UserRole).value<EntrypointDescription>();
|
||||
Core()->seek(ep.vaddr);
|
||||
}
|
||||
|
@ -174,6 +174,9 @@ void ExportsWidget::setScrollMode()
|
||||
|
||||
void ExportsWidget::on_exportsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
ExportDescription exp = index.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||
Core()->seek(exp.vaddr);
|
||||
}
|
||||
|
@ -149,6 +149,9 @@ FlagsWidget::~FlagsWidget() {}
|
||||
|
||||
void FlagsWidget::on_flagsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
FlagDescription flag = index.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
||||
Core()->seek(flag.offset);
|
||||
}
|
||||
|
@ -451,6 +451,9 @@ void FunctionsWidget::refreshTree()
|
||||
|
||||
void FunctionsWidget::onFunctionsDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
FunctionDescription function = index.data(
|
||||
FunctionModel::FunctionDescriptionRole).value<FunctionDescription>();
|
||||
Core()->seek(function.offset);
|
||||
|
@ -190,5 +190,8 @@ void ImportsWidget::setScrollMode()
|
||||
|
||||
void ImportsWidget::on_importsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
Core()->seek(index.data(ImportsModel::AddressRole).toLongLong());
|
||||
}
|
||||
|
@ -88,6 +88,9 @@ RelocsWidget::~RelocsWidget() {}
|
||||
|
||||
void RelocsWidget::on_relocsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
Core()->seek(index.data(RelocsModel::AddressRole).toLongLong());
|
||||
}
|
||||
|
||||
|
@ -113,6 +113,9 @@ void ResourcesWidget::refreshResources()
|
||||
|
||||
void ResourcesWidget::onDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
ResourcesDescription res = index.data(Qt::UserRole).value<ResourcesDescription>();
|
||||
Core()->seek(res.vaddr);
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ void SdbDock::reload(QString _path)
|
||||
|
||||
void SdbDock::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
QString newpath;
|
||||
|
||||
if (column == 0) {
|
||||
|
@ -154,6 +154,9 @@ SearchWidget::~SearchWidget() {}
|
||||
|
||||
void SearchWidget::on_searchTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
SearchDescription search = index.data(
|
||||
SearchModel::SearchDescriptionRole).value<SearchDescription>();
|
||||
Core()->seek(search.offset);
|
||||
|
@ -95,6 +95,9 @@ void SectionsWidget::fillSections(int row, const SectionDescription §ion)
|
||||
|
||||
void SectionsWidget::onSectionsDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
QTreeWidgetItem *section = tree->topLevelItem(index.row());
|
||||
auto addr = section->text(2);
|
||||
Core()->seek(addr);
|
||||
|
@ -56,14 +56,20 @@ void SidebarWidget::refresh(RVA addr)
|
||||
fillRegistersInfo();
|
||||
}
|
||||
|
||||
void SidebarWidget::on_xrefFromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||
void SidebarWidget::on_xrefFromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
Core()->seek(xref.to);
|
||||
}
|
||||
|
||||
void SidebarWidget::on_xrefToTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||
void SidebarWidget::on_xrefToTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
Core()->seek(xref.from);
|
||||
}
|
||||
|
@ -164,6 +164,9 @@ StringsWidget::~StringsWidget() {}
|
||||
|
||||
void StringsWidget::on_stringsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
StringDescription str = index.data(StringsModel::StringDescriptionRole).value<StringDescription>();
|
||||
Core()->seek(str.vaddr);
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ SymbolsWidget::~SymbolsWidget() {}
|
||||
|
||||
void SymbolsWidget::on_symbolsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
Q_UNUSED(column);
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
SymbolDescription symbol = item->data(0, Qt::UserRole).value<SymbolDescription>();
|
||||
|
@ -142,7 +142,9 @@ void TypesWidget::setScrollMode()
|
||||
|
||||
void TypesWidget::on_typesTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
// TypeDescription exp = index.data(TypesModel::TypeDescriptionRole).value<TypeDescription>();
|
||||
// Core()->seek(exp.vaddr);
|
||||
}
|
||||
|
@ -182,6 +182,9 @@ void VTablesWidget::refreshVTables()
|
||||
|
||||
void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
QModelIndex parent = index.parent();
|
||||
if (parent.isValid())
|
||||
Core()->seek(index.data(
|
||||
|
Loading…
Reference in New Issue
Block a user