Add setTitle to AlertDialog

This commit is contained in:
Krad
2022-03-08 10:04:48 +08:00
parent 3fe25ce14e
commit 13fcad6d08
2 changed files with 7 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ AlertDialog::AlertDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog
QVBoxLayout* layout = new QVBoxLayout(formWidget);
layout->setSpacing(10);
// add title
QLabel* lbl_title = new QLabel(this);
lbl_title = new QLabel(this);
lbl_title->setAlignment(Qt::AlignCenter);
lbl_title->setText(tr("Warning"));
lbl_title->setObjectName("title");
@@ -28,3 +28,7 @@ AlertDialog::~AlertDialog() {
void AlertDialog::setAlertMessage(const QString &msg) {
this->lbl_msg->setText(msg);
}
void AlertDialog::setTitle(const QString &msg) {
lbl_title->setText(msg);
}

View File

@@ -12,11 +12,13 @@ public:
explicit AlertDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~AlertDialog();
void setAlertMessage(const QString& msg);
void setTitle(const QString& msg);
protected:
bool updateReferenceData() override{return true;}
private:
QLabel* lbl_msg;
QLabel* lbl_title;
};