From 447d2cfa20ddbbeaa2e5e4d64b5b17fe184e8aa2 Mon Sep 17 00:00:00 2001 From: itayc0hen Date: Sun, 14 Jun 2020 11:52:48 +0300 Subject: [PATCH] Use QInputDialog in Functions widget --- src/widgets/FunctionsWidget.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/widgets/FunctionsWidget.cpp b/src/widgets/FunctionsWidget.cpp index 60d9189f..347072d1 100644 --- a/src/widgets/FunctionsWidget.cpp +++ b/src/widgets/FunctionsWidget.cpp @@ -3,7 +3,6 @@ #include "core/MainWindow.h" #include "common/Helpers.h" -#include "dialogs/RenameDialog.h" #include "common/FunctionsTask.h" #include "common/TempConfig.h" #include "menus/AddressableItemContextMenu.h" @@ -16,6 +15,7 @@ #include #include #include +#include namespace { @@ -526,18 +526,14 @@ void FunctionsWidget::onActionFunctionsRenameTriggered() FunctionDescription function = ui->treeView->selectionModel()->currentIndex().data( FunctionModel::FunctionDescriptionRole).value(); + bool ok; // Create dialog - RenameDialog r(this); - - // Set function name in dialog - r.setName(function.name); + QString newName = QInputDialog::getText(this, tr("Rename function %1").arg(function.name), + tr("Function name:"), QLineEdit::Normal, function.name, &ok); // If user accepted - if (r.exec()) { - // Get new function name - QString new_name = r.getName(); - + if (ok && !newName.isEmpty()) { // Rename function in r2 core - Core()->renameFunction(function.name, new_name); + Core()->renameFunction(function.name, newName); // Seek to new renamed function Core()->seekAndShow(function.offset);