2
0
forked from Ivasoft/DSView

fix: Have used a MsgBox pointer from stack

This commit is contained in:
dreamsourcelabTAI
2023-06-14 18:19:12 +08:00
parent 3c49de125c
commit 8beebd4d98
3 changed files with 21 additions and 16 deletions

View File

@@ -411,11 +411,15 @@ namespace pv
break;
}
dialogs::DSMessageBox *box = NULL;
MsgBox::Show("", title, details, this, &box, true);
// auto evo = _session->device_event_object();
//connect(evo, SIGNAL(device_updated()), box, SLOT(accept()));
// box->exec();
pv::dialogs::DSMessageBox msg(this, title);
msg.mBox()->setText(details);
msg.mBox()->setStandardButtons(QMessageBox::Ok);
msg.mBox()->setIcon(QMessageBox::Warning);
connect(_session->device_event_object(), SIGNAL(device_updated()), &msg, SLOT(accept()));
_msg = &msg;
msg.exec();
_msg = NULL;
_session->clear_error();
}

View File

@@ -34,25 +34,27 @@
void MsgBox::Show(const QString text)
{
MsgBox::Show("", text, "", NULL, NULL, true);
MsgBox::Show("", text, "", NULL, NULL);
}
void MsgBox::Show(const QString title, const QString text, QWidget *parent)
{
MsgBox::Show(title, text, "", parent,NULL, true);
MsgBox::Show(title, text, "", parent,NULL);
}
void Show(const QString title, const QString text, const QString infoText)
{
MsgBox::Show(title, text, infoText, NULL, NULL, true);
MsgBox::Show(title, text, infoText, NULL, NULL);
}
void MsgBox::Show(const QString title, const QString text, QWidget *parent, pv::dialogs::DSMessageBox **box)
void MsgBox::Show(const QString title, const QString text,
QWidget *parent, pv::dialogs::DSMessageBox **box)
{
MsgBox::Show(title, text, "", parent, box, true);
MsgBox::Show(title, text, "", parent, box);
}
void MsgBox::Show(const QString title, const QString text, const QString infoText, QWidget *parent, pv::dialogs::DSMessageBox **box, bool bExecute)
void MsgBox::Show(const QString title, const QString text, const QString infoText,
QWidget *parent, pv::dialogs::DSMessageBox **box)
{
assert(!text.isEmpty());
@@ -78,9 +80,7 @@ void MsgBox::Show(const QString title, const QString text, const QString infoTex
msg.mBox()->setInformativeText(infoText);
}
if (bExecute){
msg.exec();
}
msg.exec();
}
bool MsgBox::Confirm(const QString text, QWidget *parent)
@@ -88,7 +88,8 @@ bool MsgBox::Confirm(const QString text, QWidget *parent)
return MsgBox::Confirm(text, "", NULL, parent);
}
bool MsgBox::Confirm(const QString text, const QString infoText, pv::dialogs::DSMessageBox **box, QWidget *parent)
bool MsgBox::Confirm(const QString text, const QString infoText,
pv::dialogs::DSMessageBox **box, QWidget *parent)
{
assert(!text.isEmpty());

View File

@@ -38,7 +38,7 @@ public:
static void Show(const QString title, const QString text, QWidget *parent=0);
static void Show(const QString title, const QString text, const QString infoText);
static void Show(const QString title, const QString text, QWidget *parent, pv::dialogs::DSMessageBox **box);
static void Show(const QString title, const QString text, const QString infoText, QWidget *parent, pv::dialogs::DSMessageBox **box, bool bExecute=true);
static void Show(const QString title, const QString text, const QString infoText, QWidget *parent, pv::dialogs::DSMessageBox **box);
static bool Confirm(const QString text, QWidget *parent=0);
static bool Confirm(const QString text, const QString infoText, pv::dialogs::DSMessageBox **box=0, QWidget *parent=0);