mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +00:00
Use QInputDialog in Classes widget
This commit is contained in:
parent
3b2abf4984
commit
9c0d5d72d1
@ -4,11 +4,11 @@
|
|||||||
#include "common/Helpers.h"
|
#include "common/Helpers.h"
|
||||||
#include "common/SvgIconEngine.h"
|
#include "common/SvgIconEngine.h"
|
||||||
#include "dialogs/EditMethodDialog.h"
|
#include "dialogs/EditMethodDialog.h"
|
||||||
#include "dialogs/RenameDialog.h"
|
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
QVariant ClassesModel::headerData(int section, Qt::Orientation, int role) const
|
QVariant ClassesModel::headerData(int section, Qt::Orientation, int role) const
|
||||||
{
|
{
|
||||||
@ -740,14 +740,14 @@ void ClassesWidget::on_editMethodAction_triggered()
|
|||||||
EditMethodDialog::editMethod(className, methName, this);
|
EditMethodDialog::editMethod(className, methName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassesWidget::on_newClassAction_triggered()
|
void ClassesWidget::on_newClassAction_triggered()
|
||||||
{
|
{
|
||||||
QString name;
|
bool ok;
|
||||||
if (!RenameDialog::showDialog(tr("Create new Class"), &name, tr("Class Name"), this) || name.isEmpty()) {
|
QString name = QInputDialog::getText(this, tr("Create new Class"),
|
||||||
return;
|
tr("Class Name:"), QLineEdit::Normal, QString(), &ok);
|
||||||
}
|
if (ok && !name.isEmpty()) {
|
||||||
Core()->createNewClass(name);
|
Core()->createNewClass(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassesWidget::on_deleteClassAction_triggered()
|
void ClassesWidget::on_deleteClassAction_triggered()
|
||||||
@ -770,9 +770,10 @@ void ClassesWidget::on_renameClassAction_triggered()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString oldName = index.data(ClassesModel::NameRole).toString();
|
QString oldName = index.data(ClassesModel::NameRole).toString();
|
||||||
QString newName = oldName;
|
bool ok;
|
||||||
if (!RenameDialog::showDialog(tr("Rename Class %1").arg(oldName), &newName, tr("Class Name"), this) || newName.isEmpty()) {
|
QString newName = QInputDialog::getText(this, tr("Rename Class %1").arg(oldName),
|
||||||
return;
|
tr("Class name:"), QLineEdit::Normal, oldName, &ok);
|
||||||
}
|
if (ok && !newName.isEmpty()) {
|
||||||
Core()->renameClass(oldName, newName);
|
Core()->renameClass(oldName, newName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user