8 #include <QApplication>
11 #define ICON_SIZE (50)
12 #define ICON_SIZE_SMALL (32)
17 setWindowTitle(tr(
"Help"));
19 for (
auto screen : qApp->screens()) {
20 if (screen->geometry().height() < 900) {
25 auto *layout =
new QGridLayout(
this);
26 layout->setSpacing(2);
27 QSizePolicy sizePol(QSizePolicy::Minimum, QSizePolicy::Preferred);
28 QList<QLabel*> wrapLabels;
31 for (QAction *action : actions) {
32 if (action->icon().isNull() || action->text().isEmpty())
34 auto *icon =
new QLabel(
this);
35 icon->setPixmap(action->icon().pixmap(iconSize, iconSize, QIcon::Normal, QIcon::Off));
36 icon->setMinimumSize(iconSize + 5, iconSize + 2);
37 layout->addWidget(icon, row, 0, 3, 1, Qt::AlignTop | Qt::AlignLeft);
38 auto *headline =
new QLabel(action->toolTip(),
this);
39 QFont boldFont = headline->font();
40 boldFont.setBold(
true);
41 headline->setFont(boldFont);
42 headline->setAlignment(Qt::AlignTop | Qt::AlignLeft);
43 layout->addWidget(headline, row, 1, Qt::AlignTop);
44 auto *description =
new QLabel(action->text(),
this);
45 description->setWordWrap(
true);
46 description->setAlignment(Qt::AlignTop | Qt::AlignLeft);
47 description->setSizePolicy(sizePol);
48 wrapLabels.append(description);
49 layout->addWidget(description, row + 1, 1, Qt::AlignTop);
50 layout->setRowStretch(row + 2, 1);
51 auto *line =
new QFrame();
52 line->setFrameShape(QFrame::HLine);
53 line->setFrameShadow(QFrame::Sunken);
54 layout->addWidget(line, row + 3, 0, 1, 2);
57 layout->setColumnStretch(1, 1);
59 layout->setRowStretch(row++, 1000);
60 auto *close =
new QPushButton(tr(
"Close"),
this);
61 QFont bigFont = close->font();
62 bigFont.setPointSize(20);
63 close->setFont(bigFont);
64 close->setDefault(
true);
65 connect(close, &QPushButton::clicked,
this, &HelpWindow::hide);
66 layout->addWidget(close, row++, 0, 1, 2);
67 this->setFixedWidth(600);
68 this->setSizePolicy(sizePol);
HelpWindow(const QList< QAction * > &actions, QWidget *parent=nullptr)