BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
AboutApplicationDialog Class Reference

About BornAgain dialog. More...

Inheritance diagram for AboutApplicationDialog:
[legend]
Collaboration diagram for AboutApplicationDialog:
[legend]

Public Member Functions

 AboutApplicationDialog (QWidget *parent=0)
 

Private Member Functions

QBoxLayout * createButtonLayout ()
 
QBoxLayout * createLogoLayout ()
 
QBoxLayout * createTextLayout ()
 

Detailed Description

About BornAgain dialog.

Definition at line 24 of file aboutapplicationdialog.h.

Constructor & Destructor Documentation

◆ AboutApplicationDialog()

AboutApplicationDialog::AboutApplicationDialog ( QWidget *  parent = 0)

Definition at line 56 of file aboutapplicationdialog.cpp.

56  : QDialog(parent)
57 {
58  QColor bgColor(240, 240, 240, 255);
59  QPalette palette;
60  palette.setColor(QPalette::Window, bgColor);
61  setAutoFillBackground(true);
62  setPalette(palette);
63 
64  setWindowTitle("About BornAgain");
65  setWindowFlags(Qt::Dialog);
66 
67  QHBoxLayout* detailsLayout = new QHBoxLayout;
68  detailsLayout->addLayout(createLogoLayout());
69  detailsLayout->addLayout(createTextLayout());
70 
71  QVBoxLayout* mainLayout = new QVBoxLayout;
72  mainLayout->addLayout(detailsLayout);
73  mainLayout->addLayout(createButtonLayout());
74 
75  setLayout(mainLayout);
76 }

References createButtonLayout(), createLogoLayout(), and createTextLayout().

Here is the call graph for this function:

Member Function Documentation

◆ createButtonLayout()

QBoxLayout * AboutApplicationDialog::createButtonLayout ( )
private

Definition at line 133 of file aboutapplicationdialog.cpp.

134 {
135  auto result = new QHBoxLayout;
136 
137  auto closeButton = new QPushButton("Close");
138  connect(closeButton, &QPushButton::clicked, this, &QDialog::reject);
139 
140  result->addStretch(1);
141  result->addWidget(closeButton);
142 
143  static const char mydata[] = {0x64, 0x65, 0x76, 0x73};
144  QByteArray b = QByteArray::fromRawData(mydata, sizeof(mydata));
145  auto f = new ShortcodeFilter(b, this);
146  connect(f, &ShortcodeFilter::found, this, [=]() { layout()->addWidget(createLogoLabel()); });
147  installEventFilter(f);
148 
149  return result;
150 }
Event filter for global tracking of shortcodes.

References ShortcodeFilter::found().

Referenced by AboutApplicationDialog().

◆ createLogoLayout()

QBoxLayout * AboutApplicationDialog::createLogoLayout ( )
private

Definition at line 78 of file aboutapplicationdialog.cpp.

79 {
80  auto result = new QVBoxLayout;
81 
82  QPixmap logo(":/images/about_icon.png");
83  auto label = new QLabel;
84  label->setPixmap(logo.scaled(120, 120, Qt::KeepAspectRatio));
85 
86  result->addWidget(label);
87  result->addStretch(1);
88  result->setContentsMargins(5, 5, 5, 5);
89 
90  return result;
91 }

Referenced by AboutApplicationDialog().

◆ createTextLayout()

QBoxLayout * AboutApplicationDialog::createTextLayout ( )
private

Definition at line 93 of file aboutapplicationdialog.cpp.

94 {
95  auto result = new QVBoxLayout;
96 
97  QFont titleFont;
98  titleFont.setPointSize(DesignerHelper::getLabelFontSize() + 2);
99  titleFont.setBold(true);
100 
101  QFont normalFont;
102  normalFont.setPointSize(DesignerHelper::getLabelFontSize());
103  normalFont.setBold(false);
104 
105  // title
106  auto aboutTitleLabel =
107  new QLabel(QString("BornAgain version ").append(GUIHelpers::getBornAgainVersionString()));
108  aboutTitleLabel->setFont(titleFont);
109  aboutTitleLabel->setContentsMargins(0, 0, 0, 15);
110 
111  // copyright
112  auto copyrightLabel = createCopyrightLabel();
113  copyrightLabel->setFont(normalFont);
114 
115  // description
116  QString description = "A software to simulate and fit grazing-incidence small-angle "
117  "scattering (GISAS) using distorted wave Born approximation (DWBA).";
118  auto descriptionLabel = new QLabel(description);
119  descriptionLabel->setFont(normalFont);
120  descriptionLabel->setWordWrap(true);
121 
122  result->addWidget(aboutTitleLabel);
123  result->addWidget(descriptionLabel);
124  result->addStretch(1);
125  result->addWidget(copyrightLabel);
126  result->addWidget(createLinkLabel());
127  result->addStretch(1);
128  result->setContentsMargins(0, 5, 5, 5);
129 
130  return result;
131 }
static int getLabelFontSize()
QString getBornAgainVersionString()
Definition: GUIHelpers.cpp:130

References GUIHelpers::getBornAgainVersionString(), and DesignerHelper::getLabelFontSize().

Referenced by AboutApplicationDialog().

Here is the call graph for this function:

The documentation for this class was generated from the following files: