SpecMsgBox в процессе исправления

This commit is contained in:
2025-11-28 21:01:33 +03:00
parent 8ad6d06f18
commit fb493aca9f
17 changed files with 169 additions and 60 deletions

View File

@@ -2,7 +2,7 @@
#include "specialmessagebox.h"
#include "ui_specialmessagebox.h"
SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
SpecMsgBox::SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
QDialog(parent),
ui(new Ui::SpecialMessageBox)
{
@@ -22,14 +22,14 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
ui->btnNo->setVisible(false);
ui->btnYes->setText(tr("Close"));
}
else if(type == TypeSpecMsgBox::critical)
else if(type == TypeSpecMsgBox::criticalClose)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png")));
this->setWindowTitle(tr("Error!"));
ui->btnNo->setVisible(false);
ui->btnYes->setText(tr("Close"));
}
else if(type == TypeSpecMsgBox::info)
else if(type == TypeSpecMsgBox::infoOk)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png")));
this->setWindowTitle(tr("Information"));
@@ -40,17 +40,43 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
ui->lblText->setText(text);
}
SpecialMessageBox::~SpecialMessageBox()
SpecMsgBox::~SpecMsgBox()
{
delete ui;
}
void SpecialMessageBox::on_btnYes_clicked()
int SpecMsgBox::WarningYesNo(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningYesNo, text);
}
int SpecMsgBox::WarningClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningClose, text);
}
int SpecMsgBox::CriticalClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::criticalClose, text);
}
int SpecMsgBox::InfoOk(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::infoOk, text);
}
int SpecMsgBox::work(SpecMsgBox *msgBox, QWidget *parent, TypeSpecMsgBox type, const QString& text)
{
msgBox = new SpecMsgBox(parent, type, text);
return msgBox->exec();
}
void SpecMsgBox::on_btnYes_clicked()
{
this->accept();
}
void SpecialMessageBox::on_btnNo_clicked()
void SpecMsgBox::on_btnNo_clicked()
{
this->reject();
}