-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaboutwidget.cc
53 lines (42 loc) · 1.51 KB
/
aboutwidget.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "aboutwidget.hpp"
#include <utils/appinfo.hpp>
#include <utils/utils.h>
#include <QtWidgets>
namespace Plugin {
AboutWidget::AboutWidget(QWidget *parent)
: QWidget{parent}
{
setupUI();
}
void AboutWidget::setupUI()
{
auto text = QString("<span style=\"font-size: 24px;\"><b>%1</b></span> <span "
"style=\"font-size: 24px;\">%2</span><br>")
.arg(Utils::appName, Utils::version.toString());
auto *textLayout = new QVBoxLayout;
textLayout->setSpacing(20);
textLayout->addStretch();
textLayout->addWidget(new QLabel{text, this});
textLayout->addWidget(new QLabel{Utils::systemInfo(), this});
textLayout->addWidget(new QLabel{Utils::copyright, this});
textLayout->addStretch();
auto *iconButton = new QToolButton(this);
iconButton->setIconSize({64, 64});
iconButton->setIcon(qApp->windowIcon());
auto *topLayout = new QHBoxLayout;
topLayout->setSpacing(20);
topLayout->addWidget(iconButton);
topLayout->addStretch();
topLayout->addLayout(textLayout);
topLayout->addStretch();
auto *aboutQtButton = new QToolButton(this);
aboutQtButton->setText(tr("About Qt"));
connect(aboutQtButton, &QToolButton::clicked, qApp, &QApplication::aboutQt);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(30, 30, 30, 30);
layout->addStretch();
layout->addLayout(topLayout);
layout->addStretch();
layout->addWidget(aboutQtButton, 0, Qt::AlignCenter);
}
} // namespace Plugin