mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Use QInputDialog in Flags widget
This commit is contained in:
parent
d6edae4ced
commit
21aef22c45
@ -1,7 +1,6 @@
|
|||||||
#include "FlagsWidget.h"
|
#include "FlagsWidget.h"
|
||||||
#include "ui_FlagsWidget.h"
|
#include "ui_FlagsWidget.h"
|
||||||
#include "core/MainWindow.h"
|
#include "core/MainWindow.h"
|
||||||
#include "dialogs/RenameDialog.h"
|
|
||||||
#include "common/Helpers.h"
|
#include "common/Helpers.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@ -9,6 +8,7 @@
|
|||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
FlagsModel::FlagsModel(QList<FlagDescription> *flags, QObject *parent)
|
FlagsModel::FlagsModel(QList<FlagDescription> *flags, QObject *parent)
|
||||||
: AddressableItemModel<QAbstractListModel>(parent),
|
: AddressableItemModel<QAbstractListModel>(parent),
|
||||||
@ -204,11 +204,11 @@ void FlagsWidget::on_actionRename_triggered()
|
|||||||
FlagDescription flag = ui->flagsTreeView->selectionModel()->currentIndex().data(
|
FlagDescription flag = ui->flagsTreeView->selectionModel()->currentIndex().data(
|
||||||
FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
||||||
|
|
||||||
RenameDialog r(this);
|
bool ok;
|
||||||
r.setName(flag.name);
|
QString newName = QInputDialog::getText(this, tr("Rename flag %1").arg(flag.name),
|
||||||
if (r.exec()) {
|
tr("Flag name:"), QLineEdit::Normal, flag.name, &ok);
|
||||||
QString new_name = r.getName();
|
if (ok && !newName.isEmpty()) {
|
||||||
Core()->renameFlag(flag.name, new_name);
|
Core()->renameFlag(flag.name, newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user