BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GUI::View::Helpers Namespace Reference

Functions

void information (QWidget *parent, const QString &title, const QString &text, const QString &detailedText)
 
bool okToDelete (QWidget *parent, const QString &title, const QString &text, const QString &detailedText)
 
bool question (QWidget *parent, const QString &title, const QString &text, const QString &detailedText, const QString &yesText, const QString &noText)
 
void warning (QWidget *parent, const QString &title, const QString &text, const QString &detailedText)
 

Function Documentation

◆ information()

void GUI::View::Helpers::information ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  detailedText 
)

Definition at line 22 of file MessageBox.cpp.

24 {
25  QScopedPointer<QMessageBox> messageBox(new QMessageBox(parent));
26  if (parent)
27  messageBox->setWindowModality(Qt::WindowModal);
28  messageBox->setWindowTitle(QString("%1 - %2").arg(QApplication::applicationName()).arg(title));
29  messageBox->setText(text);
30  if (!detailedText.isEmpty())
31  messageBox->setInformativeText(detailedText);
32  messageBox->setIcon(QMessageBox::Information);
33  messageBox->addButton(QMessageBox::Ok);
34  messageBox->exec();
35 }

Referenced by PyImportAssistant::itemizeSample(), SpecularDataImportWidget::onFormatSelectionChanged(), and InstrumentListView::onLoadFromLibrary().

◆ okToDelete()

bool GUI::View::Helpers::okToDelete ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  detailedText 
)

Definition at line 70 of file MessageBox.cpp.

72 {
73  QScopedPointer<QMessageBox> messageBox(new QMessageBox(parent));
74  if (parent)
75  messageBox->setWindowModality(Qt::WindowModal);
76  messageBox->setIcon(QMessageBox::Question);
77  messageBox->setWindowTitle(QString("%1 - %2").arg(QApplication::applicationName()).arg(title));
78  messageBox->setText(text);
79  if (!detailedText.isEmpty())
80  messageBox->setInformativeText(detailedText);
81  QAbstractButton* deleteButton = messageBox->addButton("&Delete", QMessageBox::AcceptRole);
82  messageBox->addButton("Do &Not Delete", QMessageBox::RejectRole);
83  messageBox->setDefaultButton(qobject_cast<QPushButton*>(deleteButton));
84  messageBox->exec();
85  return messageBox->clickedButton() == deleteButton;
86 }

◆ question()

bool GUI::View::Helpers::question ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  detailedText,
const QString &  yesText,
const QString &  noText 
)

Definition at line 52 of file MessageBox.cpp.

54 {
55  QScopedPointer<QMessageBox> messageBox(new QMessageBox(parent));
56  if (parent)
57  messageBox->setWindowModality(Qt::WindowModal);
58  messageBox->setWindowTitle(QString("%1 - %2").arg(QApplication::applicationName()).arg(title));
59  messageBox->setText(text);
60  if (!detailedText.isEmpty())
61  messageBox->setInformativeText(detailedText);
62  messageBox->setIcon(QMessageBox::Question);
63  QAbstractButton* yesButton = messageBox->addButton(yesText, QMessageBox::AcceptRole);
64  messageBox->addButton(noText, QMessageBox::RejectRole);
65  messageBox->setDefaultButton(qobject_cast<QPushButton*>(yesButton));
66  messageBox->exec();
67  return messageBox->clickedButton() == yesButton;
68 }

Referenced by ProjectManager::restoreProjectDialog(), and IntensityDataCanvas::rotateData().

◆ warning()

void GUI::View::Helpers::warning ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  detailedText 
)

Definition at line 37 of file MessageBox.cpp.

39 {
40  QScopedPointer<QMessageBox> messageBox(new QMessageBox(parent));
41  if (parent)
42  messageBox->setWindowModality(Qt::WindowModal);
43  messageBox->setWindowTitle(QString("%1 - %2").arg(QApplication::applicationName()).arg(title));
44  messageBox->setText(text);
45  if (!detailedText.isEmpty())
46  messageBox->setInformativeText(detailedText);
47  messageBox->setIcon(QMessageBox::Warning);
48  messageBox->addButton(QMessageBox::Ok);
49  messageBox->exec();
50 }

Referenced by LinkInstrumentManager::canLinkDataToInstrument(), MainWindow::closeEvent(), SimulationView::exportPythonScript(), RealDataSelectorWidget::importData1D(), RealDataSelectorWidget::importData2D(), PythonScriptWidget::onExportToFileButton(), ProjectSettingsView::onFunctionalityToggled(), ProjectSettingsView::onSingleInstrumentRadioToggled(), ProjectSettingsView::onSingleSampleRadioToggled(), MaterialEditorDialog::removeCurrentMaterial(), ProjectManager::riseProjectLoadFailedDialog(), RealSpaceCanvas::savePicture(), GUI::Plot::savePlot(), ProjectManager::saveProject(), and SimulationView::simulate().