Skip to content

Commit 6d37cd0

Browse files
committed
GUI: Add program icon to the About-dialog.
1 parent d5a5df7 commit 6d37cd0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

gui/aboutdialog.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent)
2727
, mVersion(version)
2828
{
2929
setWindowTitle(tr("About cppcheck"));
30+
// Left icon area and right text area
31+
QHBoxLayout *iconLayout = new QHBoxLayout(this);
32+
// Keep icon at the top of the dialog
33+
QVBoxLayout *iconVLayout = new QVBoxLayout(this);
34+
// Texts
3035
QVBoxLayout *mainLayout = new QVBoxLayout(this);
36+
// Keep close button in right
3137
QHBoxLayout *btnLayout = new QHBoxLayout(this);
3238

39+
QIcon *icon = new QIcon(":icon.png");
40+
QLabel *iconLabel = new QLabel();
41+
iconLabel->setPixmap(icon->pixmap(QSize(48, 48)));
3342
QLabel *name = new QLabel(tr("Cppcheck - A tool for static C/C++ code analysis."));
3443
QLabel *ver = new QLabel(QString(tr("Version %1")).arg(mVersion));
3544
QLabel *copy = new QLabel(("Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team."));
@@ -46,6 +55,12 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent)
4655
mainLayout->addStretch();
4756

4857
mainLayout->addLayout(btnLayout);
58+
59+
iconVLayout->addWidget(iconLabel);
60+
iconVLayout->addStretch();
61+
iconLayout->addLayout(iconVLayout);
62+
iconLayout->addLayout(mainLayout);
63+
4964
btnLayout->addStretch();
5065
btnLayout->addWidget(quit);
5166

0 commit comments

Comments
 (0)