1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
6 * Created on: Apr 28, 2014
9 #include <XGUI_ErrorDialog.h>
11 #include <ModuleBase_Tools.h>
13 #include <QDialogButtonBox>
14 #include <QHBoxLayout>
16 #include <QVBoxLayout>
19 XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent)
22 QVBoxLayout* aDlgLay = new QVBoxLayout(this);
23 setWindowTitle(tr("Application errors"));
24 myErrorLog = new QTextEdit(this);
25 myErrorLog->setReadOnly(true);
26 aDlgLay->addWidget(myErrorLog);
27 QDialogButtonBox* aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal,
29 aDlgLay->addWidget(aButtonBox);
30 aDlgLay->setContentsMargins(2, 2, 2, 2);
31 aDlgLay->setSpacing(2);
35 connect(aButtonBox, SIGNAL(accepted()), this, SLOT(clear()));
36 connect(aButtonBox, SIGNAL(rejected()), this, SLOT(clear()));
39 XGUI_ErrorDialog::~XGUI_ErrorDialog()
43 void XGUI_ErrorDialog::refresh()
46 foreach(QString eachError, myErrors)
48 myErrorLog->append(eachError);
52 void XGUI_ErrorDialog::clear()
59 void XGUI_ErrorDialog::addError(const QString& theError)
61 myErrors.append(theError);
66 ModuleBase_Tools::activateWindow(this, "XGUI_ErrorDialog::addError");
70 void XGUI_ErrorDialog::removeError(const QString& theError)
72 myErrors.removeAll(theError);