2017-10-01 19:09:42 +00:00
|
|
|
#include "RenameDialog.h"
|
|
|
|
#include "ui_RenameDialog.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
RenameDialog::RenameDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::RenameDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-03-31 00:51:14 +00:00
|
|
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
RenameDialog::~RenameDialog() {}
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void RenameDialog::on_buttonBox_accepted()
|
|
|
|
{
|
|
|
|
// Rename function and refresh widgets
|
|
|
|
QString name = ui->nameEdit->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RenameDialog::on_buttonBox_rejected()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
2017-11-26 16:53:05 +00:00
|
|
|
void RenameDialog::setName(QString fcnName)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
ui->nameEdit->setText(fcnName);
|
2019-07-03 06:52:06 +00:00
|
|
|
ui->nameEdit->selectAll();
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2017-11-26 16:53:05 +00:00
|
|
|
QString RenameDialog::getName() const
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
2017-10-01 18:08:12 +00:00
|
|
|
return ui->nameEdit->text();
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
2018-08-18 19:28:04 +00:00
|
|
|
|
|
|
|
void RenameDialog::setPlaceholderText(const QString &text)
|
|
|
|
{
|
|
|
|
ui->nameEdit->setPlaceholderText(text);
|
2019-02-07 12:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool RenameDialog::showDialog(const QString &title, QString *name, const QString &placeholder, QWidget *parent)
|
|
|
|
{
|
|
|
|
RenameDialog dialog(parent);
|
|
|
|
dialog.setWindowTitle(title);
|
|
|
|
dialog.setPlaceholderText(placeholder);
|
|
|
|
dialog.setName(*name);
|
|
|
|
int result = dialog.exec();
|
|
|
|
*name = dialog.getName();
|
|
|
|
return result == QDialog::DialogCode::Accepted;
|
|
|
|
}
|