cutter/src/dialogs/RenameDialog.h

47 lines
1.0 KiB
C
Raw Normal View History

#ifndef RENAMEDIALOG_H
#define RENAMEDIALOG_H
#include <QDialog>
2017-10-02 09:41:28 +00:00
#include <memory>
2018-03-21 20:32:32 +00:00
namespace Ui {
class RenameDialog;
}
2019-03-06 20:30:39 +00:00
/**
* @brief General Dialog for entering a name
*/
class RenameDialog : public QDialog
{
Q_OBJECT
public:
explicit RenameDialog(QWidget *parent = nullptr);
~RenameDialog();
2017-11-26 16:53:05 +00:00
void setName(QString fcnName);
QString getName() const;
void setPlaceholderText(const QString &text);
2019-03-06 20:30:39 +00:00
/**
* @brief Helper function to display and execute the dialog
*
2019-03-06 20:30:39 +00:00
* @param title title of the dialog
* @param name initial name, will be overwritten if the user entered something else
* @param placeholder placeholder text for the QLineEdit
* @return whether the dialog was accepted by the user
*/
static bool showDialog(const QString &title, QString *name, const QString &placeholder, QWidget *parent = nullptr);
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
2017-10-02 09:41:28 +00:00
std::unique_ptr<Ui::RenameDialog> ui;
};
#endif // RENAMEDIALOG_H