Commit 3bdc50d1 authored by Kai Koehne's avatar Kai Koehne Committed by hjk
Browse files

Fix break point warning dialog



QMessageBox apparently only saves the state in the actual
QMessageBox instance ... anyhow, it's the only place in
QtCreator where we use QMessageBox, which makes it look
somewhat alien. Instead, use CheckableMessageBox and
extend it for an information dialog.

Task-number: QTCREATORBUG-9876

Change-Id: I8014e972943dd4a336952325ebb9f6cbc5dd0902
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent f29ce3d9
...@@ -256,6 +256,28 @@ CheckableMessageBox::question(QWidget *parent, ...@@ -256,6 +256,28 @@ CheckableMessageBox::question(QWidget *parent,
return mb.clickedStandardButton(); return mb.clickedStandardButton();
} }
QDialogButtonBox::StandardButton
CheckableMessageBox::information(QWidget *parent,
const QString &title,
const QString &text,
const QString &checkBoxText,
bool *checkBoxSetting,
QDialogButtonBox::StandardButtons buttons,
QDialogButtonBox::StandardButton defaultButton)
{
CheckableMessageBox mb(parent);
mb.setWindowTitle(title);
mb.setIconPixmap(QMessageBox::standardIcon(QMessageBox::Information));
mb.setText(text);
mb.setCheckBoxText(checkBoxText);
mb.setChecked(*checkBoxSetting);
mb.setStandardButtons(buttons);
mb.setDefaultButton(defaultButton);
mb.exec();
*checkBoxSetting = mb.isChecked();
return mb.clickedStandardButton();
}
QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton db) QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton db)
{ {
return static_cast<QMessageBox::StandardButton>(int(db)); return static_cast<QMessageBox::StandardButton>(int(db));
......
...@@ -62,6 +62,15 @@ public: ...@@ -62,6 +62,15 @@ public:
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes|QDialogButtonBox::No, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes|QDialogButtonBox::No,
QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No); QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No);
static QDialogButtonBox::StandardButton
information(QWidget *parent,
const QString &title,
const QString &text,
const QString &checkBoxText,
bool *checkBoxSetting,
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok,
QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton);
QString text() const; QString text() const;
void setText(const QString &); void setText(const QString &);
......
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
#include <utils/checkablemessagebox.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QErrorMessage>
#include <QTcpServer> #include <QTcpServer>
using namespace Debugger::Internal; using namespace Debugger::Internal;
...@@ -209,9 +209,14 @@ void DebuggerRunControl::start() ...@@ -209,9 +209,14 @@ void DebuggerRunControl::start()
debuggerCore()->showMessage(warningMessage, LogWarning); debuggerCore()->showMessage(warningMessage, LogWarning);
QErrorMessage *msgBox = new QErrorMessage(debuggerCore()->mainWindow()); static bool checked = true;
msgBox->setAttribute(Qt::WA_DeleteOnClose); if (!checked)
msgBox->showMessage(warningMessage); break;
CheckableMessageBox::information(debuggerCore()->mainWindow(),
tr("Debugger"),
warningMessage,
tr("&Show this message again."),
&checked, QDialogButtonBox::Ok);
break; break;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment