19 #include <QGridLayout>
21 #include <QListWidget>
22 #include <QPushButton>
27 const int top_panel_height = 80;
31 QString documentVersion)
33 , m_projectDocumentVersion(std::move(documentVersion))
35 setMinimumSize(256, 256);
37 setWindowTitle(
"Problems encountered while loading project");
38 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
40 auto* mainLayout =
new QVBoxLayout;
44 titleFont.setBold(
true);
46 const auto addHeadline = [&](
const QString& text) {
47 auto* label =
new QLabel(text,
this);
48 label->setFont(titleFont);
49 mainLayout->addWidget(label);
53 auto* topPanelLayout =
new QHBoxLayout;
54 auto* messageLabel =
new QLabel(
"Some parts of the project were not loaded correctly.");
55 messageLabel->setFont(titleFont);
56 messageLabel->setWordWrap(
true);
59 topPanelLayout->addWidget(messageLabel);
60 topPanelLayout->setContentsMargins(0, 0, 0, 0);
61 mainLayout->addLayout(topPanelLayout);
64 addHeadline(
"Why did this happen?");
66 explanationLabel->setWordWrap(
true);
67 mainLayout->addWidget(explanationLabel);
69 addHeadline(
"What to do?");
71 new QLabel(
"Check parameters of your items and re-enter uninitialized values. "
72 "Use detailed log below to get a hint what went wrong. "
73 "After that, save your project and work as normal.");
74 adviceLabel->setWordWrap(
true);
75 mainLayout->addWidget(adviceLabel);
78 addHeadline(
"Details:");
79 auto* detailsWidget =
new QListWidget;
80 detailsWidget->setWordWrap(
true);
81 detailsWidget->setAlternatingRowColors(
true);
82 detailsWidget->addItems(details);
83 mainLayout->addWidget(detailsWidget);
88 setLayout(mainLayout);
89 setAttribute(Qt::WA_DeleteOnClose,
true);
94 auto* warningLabel =
new QLabel;
95 warningLabel->setPixmap(QPixmap(
":/images/warning_64x64.png"));
97 auto* warningWidget =
new QWidget;
98 warningWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
99 warningWidget->resize(top_panel_height, top_panel_height);
100 auto* warningWidgetLayout =
new QHBoxLayout;
101 warningWidgetLayout->addWidget(warningLabel);
102 warningWidget->setLayout(warningWidgetLayout);
104 return warningWidget;
109 auto* button =
new QPushButton(
"Close",
this);
110 button->setAutoDefault(
false);
111 connect(button, &QPushButton::clicked,
this, &ProjectLoadProblemDialog::close);
113 auto* result =
new QHBoxLayout;
114 result->addStretch(3);
115 result->setContentsMargins(0, 0, 0, 0);
116 result->addWidget(button);
126 "Given project was created using BornAgain version %1 "
127 " which is different from version %2 you are currently using. "
128 "At the moment we provide only limited support for import from older versions.")
133 return QString(
"Given project was created using BornAgain version %1 "
134 "which is the same as the current version of the framework. "
135 "Strangely enough, some parts were not loaded correctly due to format mismatch. "
136 "Please contact the developers.")
Defines class DesignerHelper.
Defines class Helpers functions.
Defines class ProjectLoadProblemDialog.
static int getSectionFontSize()
Returns system dependent font size.
QString explanationText() const
Returns explanations what went wrong.
QWidget * createWarningWidget()
ProjectLoadProblemDialog(QWidget *parent, const QStringList &details, QString documentVersion)
QString m_projectDocumentVersion
QString getBornAgainVersionString()