#include "helpwindow.h" #include #include #include #include HelpWindow::HelpWindow(const QList &actions, QWidget *parent) : QDialog(parent) { QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setMargin(3); // Add help items for (QAction *action : actions) { if (action->icon().isNull() || action->text().isEmpty()) continue; QBoxLayout *rowLayout = new QBoxLayout(QBoxLayout::LeftToRight, nullptr); QLabel *icon = new QLabel(this); icon->setPixmap(action->icon().pixmap(55, 55, QIcon::Normal, QIcon::Off)); rowLayout->addWidget(icon); QBoxLayout *textLayout = new QBoxLayout(QBoxLayout::TopToBottom, nullptr); QLabel *headline = new QLabel(action->toolTip(), this); QFont boldFont = headline->font(); boldFont.setBold(true); headline->setFont(boldFont); textLayout->addWidget(headline); QLabel *description = new QLabel(action->text(), this); description->setWordWrap(true); textLayout->addWidget(description); textLayout->addStretch(1); rowLayout->addLayout(textLayout, 1); layout->addLayout(rowLayout); } // Add close button QPushButton *close = new QPushButton(tr("Close"), this); QFont bigFont = close->font(); bigFont.setPointSize(20); close->setFont(bigFont); connect(close, SIGNAL(clicked()), this, SLOT(hide())); layout->addStretch(1); layout->addWidget(close); this->setMinimumSize(600, 600); }