2
0
forked from Ivasoft/DSView

fix: The confirm box to swich device is too much

This commit is contained in:
dreamsourcelabTAI
2023-06-07 18:57:36 +08:00
parent 37091e3a8a
commit e9641a4dbf
3 changed files with 10 additions and 4 deletions

View File

@@ -1921,9 +1921,11 @@ namespace pv
{ {
QString msgText = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_TO_SWITCH_DEVICE), "To switch the new device?"); QString msgText = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_TO_SWITCH_DEVICE), "To switch the new device?");
if (MsgBox::Confirm(msgText) == false){ if (MsgBox::Confirm(msgText, "", &_msg, NULL) == false){
_msg = NULL;
return; return;
} }
_msg = NULL;
} }
// The store confirm is not processed. // The store confirm is not processed.

View File

@@ -85,10 +85,10 @@ void MsgBox::Show(const QString title, const QString text, const QString infoTex
bool MsgBox::Confirm(const QString text, QWidget *parent) bool MsgBox::Confirm(const QString text, QWidget *parent)
{ {
return MsgBox::Confirm(text, "", parent); return MsgBox::Confirm(text, "", NULL, parent);
} }
bool MsgBox::Confirm(const QString text, const QString infoText, QWidget *parent) bool MsgBox::Confirm(const QString text, const QString infoText, pv::dialogs::DSMessageBox **box, QWidget *parent)
{ {
assert(!text.isEmpty()); assert(!text.isEmpty());
@@ -110,6 +110,10 @@ bool MsgBox::Confirm(const QString text, const QString infoText, QWidget *parent
msg.mBox()->setInformativeText(infoText); msg.mBox()->setInformativeText(infoText);
} }
if (box != NULL){
*box = &msg;
}
msg.exec(); msg.exec();
return msg.IsYes(); return msg.IsYes();
} }

View File

@@ -41,5 +41,5 @@ public:
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, bool bExecute=true);
static bool Confirm(const QString text, QWidget *parent=0); static bool Confirm(const QString text, QWidget *parent=0);
static bool Confirm(const QString text, const QString infoText, QWidget *parent=0); static bool Confirm(const QString text, const QString infoText, pv::dialogs::DSMessageBox **box=0, QWidget *parent=0);
}; };