forked from qt-creator/qt-creator
Core: Return some handle when creating an AsynchronousMessageBox
User code might want to keep a QPointer around e.g. to prevent double instantiation of some box, or delete it automatically after a while. Change-Id: Iaa994c2abf321c35ffb3bcb0050d72939c55d941 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -34,7 +34,7 @@ namespace AsynchronousMessageBox {
|
||||
|
||||
namespace {
|
||||
|
||||
void message(QMessageBox::Icon icon, const QString &title, const QString &desciption)
|
||||
QWidget *message(QMessageBox::Icon icon, const QString &title, const QString &desciption)
|
||||
{
|
||||
QMessageBox *messageBox = new QMessageBox(icon,
|
||||
title,
|
||||
@@ -45,23 +45,24 @@ void message(QMessageBox::Icon icon, const QString &title, const QString &descip
|
||||
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
messageBox->setModal(true);
|
||||
messageBox->show();
|
||||
return messageBox;
|
||||
}
|
||||
}
|
||||
|
||||
void warning(const QString &title, const QString &desciption)
|
||||
QWidget *warning(const QString &title, const QString &desciption)
|
||||
{
|
||||
message(QMessageBox::Warning, title, desciption);
|
||||
return message(QMessageBox::Warning, title, desciption);
|
||||
}
|
||||
|
||||
void information(const QString &title, const QString &desciption)
|
||||
QWidget *information(const QString &title, const QString &desciption)
|
||||
{
|
||||
message(QMessageBox::Information, title, desciption);
|
||||
return message(QMessageBox::Information, title, desciption);
|
||||
}
|
||||
|
||||
void critical(const QString &title, const QString &desciption)
|
||||
QWidget *critical(const QString &title, const QString &desciption)
|
||||
{
|
||||
message(QMessageBox::Critical, title, desciption);
|
||||
}
|
||||
return message(QMessageBox::Critical, title, desciption);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -29,13 +29,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
namespace AsynchronousMessageBox {
|
||||
|
||||
CORE_EXPORT void warning(const QString &title, const QString &desciption);
|
||||
CORE_EXPORT void information(const QString &title, const QString &desciption);
|
||||
CORE_EXPORT void critical(const QString &title, const QString &desciption);
|
||||
CORE_EXPORT QWidget *warning(const QString &title, const QString &desciption);
|
||||
CORE_EXPORT QWidget *information(const QString &title, const QString &desciption);
|
||||
CORE_EXPORT QWidget *critical(const QString &title, const QString &desciption);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user