21 #include <QPushButton>
22 #include <QVBoxLayout>
26 QLabel* createLinkLabel(
const QString& text)
28 auto* result =
new QLabel();
29 result->setTextFormat(Qt::RichText);
30 result->setTextInteractionFlags(Qt::TextBrowserInteraction);
31 result->setText(text);
32 result->setOpenExternalLinks(
true);
36 QLabel* createLogoLabel()
38 QPixmap logo(
":/images/about_icon.awk",
"JPG");
39 auto* result =
new QLabel;
40 result->setPixmap(logo.scaled(656, 674, Qt::KeepAspectRatio));
49 QColor bgColor(240, 240, 240, 255);
51 palette.setColor(QPalette::Window, bgColor);
52 setAutoFillBackground(
true);
55 setWindowTitle(
"About BornAgain");
56 setWindowFlags(Qt::Dialog);
58 auto* detailsLayout =
new QHBoxLayout;
62 auto* mainLayout =
new QVBoxLayout;
63 mainLayout->addLayout(detailsLayout);
66 setLayout(mainLayout);
71 auto* result =
new QVBoxLayout;
73 QPixmap logo(
":/images/about_icon.png");
74 auto* label =
new QLabel;
75 label->setPixmap(logo.scaled(120, 120, Qt::KeepAspectRatio));
77 result->addWidget(label);
78 result->addStretch(1);
79 result->setContentsMargins(5, 5, 5, 5);
86 auto* result =
new QVBoxLayout;
90 titleFont.setBold(
true);
94 normalFont.setBold(
false);
97 auto* aboutTitleLabel =
99 aboutTitleLabel->setFont(titleFont);
102 QString description =
"Open-source research software to simulate and fit neutron and x-ray"
103 " reflectometry and grazing-incidence small-angle scattering.";
104 auto* descriptionLabel =
new QLabel(description);
105 descriptionLabel->setFont(normalFont);
106 descriptionLabel->setWordWrap(
true);
109 auto* copyrightLabel =
new QLabel(
"Copyright: Forschungszentrum Jülich GmbH 2012-"
110 + QDate::currentDate().
toString(
"yyyy") +
".");
111 copyrightLabel->setFont(normalFont);
114 auto* homepageLabel = createLinkLabel(
116 " <a href=\"https://www.bornagainproject.org\">www.bornagainproject.org</a>.");
117 homepageLabel->setFont(normalFont);
120 auto* mailingLabel = createLinkLabel(
121 "For updates, subscribe to <a "
122 "href = \"https://lists.fz-juelich.de/mailman/listinfo/BornAgain-announcements\">"
123 "bornagain-announcements</a>.");
124 mailingLabel->setFont(normalFont);
125 mailingLabel->setWordWrap(
true);
127 result->addWidget(aboutTitleLabel);
128 result->addStretch(1);
129 result->addWidget(descriptionLabel);
130 result->addStretch(1);
131 result->addWidget(copyrightLabel);
132 result->addStretch(1);
133 result->addWidget(homepageLabel);
134 result->addStretch(1);
135 result->addWidget(mailingLabel);
136 result->addStretch(1);
143 auto* result =
new QHBoxLayout;
145 auto* closeButton =
new QPushButton(
"Close");
146 connect(closeButton, &QPushButton::clicked,
this, &QDialog::reject);
148 result->addStretch(1);
149 result->addWidget(closeButton);
151 static const char mydata[] = {0x64, 0x65, 0x76, 0x73};
152 QByteArray b = QByteArray::fromRawData(mydata,
sizeof(mydata));
155 installEventFilter(f);
Defines class AboutDialog.
Defines classes releted to event filtering.
Defines class DesignerHelper.
Defines class Helpers functions.
QBoxLayout * createButtonLayout()
QBoxLayout * createTextLayout()
AboutDialog(QWidget *parent=nullptr)
QBoxLayout * createLogoLayout()
static int getLabelFontSize()
Event filter for global tracking of shortcodes.
QString getBornAgainVersionString()
QString toString(const QModelIndex &index)
Provides string representation of index data.