41 const std::vector<const char *> &dependencyVersions,
const QString &website,
const QString &description,
const QImage &image)
46 makeHeading(m_ui->productNameLabel);
47 setStyleSheet(dialogStyleForPalette(palette()));
48 setWindowFlags((windowFlags()) & ~(Qt::WindowMinMaxButtonsHint | Qt::WindowContextHelpButtonHint | Qt::WindowFullscreenButtonHint));
49 if (!applicationName.isEmpty()) {
50 m_ui->productNameLabel->setText(applicationName);
51 }
else if (!QApplication::applicationDisplayName().isEmpty()) {
52 m_ui->productNameLabel->setText(QApplication::applicationDisplayName());
54 m_ui->productNameLabel->setText(QApplication::applicationName());
56 if (creator.startsWith(QLatin1Char(
'<'))) {
58 m_ui->creatorLabel->setText(creator);
61 auto setCreator = [
this, creator = std::move(creator)] {
62 m_ui->creatorLabel->setText(tr(
"developed by %1").arg(creator.isEmpty() ? QApplication::organizationName() : creator));
67 m_ui->versionLabel->setText(version.isEmpty() ? QApplication::applicationVersion() : version);
68 const auto &deps(dependencyVersions.size() ? dependencyVersions : CppUtilities::applicationInfo.dependencyVersions);
70 QStringList linkedAgainst;
71 linkedAgainst.reserve(
static_cast<int>(deps.size()));
72 for (
const auto &dependencyVersion : deps) {
73 linkedAgainst << QString::fromUtf8(dependencyVersion);
75 m_ui->versionLabel->setToolTip(QStringLiteral(
"<p>") % tr(
"Linked against:") % QStringLiteral(
"</p><ul><li>")
76 % linkedAgainst.join(QStringLiteral(
"</li><li>")) % QStringLiteral(
"</li></ul>"));
78 if (!website.isEmpty() || CppUtilities::applicationInfo.url) {
79 auto setWebsite = [
this, website = std::move(website)] {
80 m_ui->websiteLabel->setText(tr(
"For updates and bug reports visit the <a href=\"%1\" "
81 "style=\"text-decoration: underline; color: palette(link);\">project "
83 .arg(!website.isEmpty() ? website : QString::fromUtf8(CppUtilities::applicationInfo.url)));
88 m_ui->websiteLabel->hide();
90 m_ui->descLabel->setText(description.isEmpty() && CppUtilities::applicationInfo.description
91 ? QString::fromUtf8(CppUtilities::applicationInfo.description)
93 m_iconScene =
new QGraphicsScene(
this);
94 auto *item = image.isNull()
95 ?
new QGraphicsPixmapItem(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation,
nullptr,
this).pixmap(128))
96 :
new QGraphicsPixmapItem(QPixmap::fromImage(image));
97 m_iconScene->addItem(item);
98 m_ui->graphicsView->setScene(m_iconScene);
99 auto setQtVersion = [
this] { m_ui->qtVersionLabel->setText(tr(
"Using <a href=\"qtversion\">Qt %1</a>").arg(QString::fromUtf8(qVersion()))); };
102 connect(m_ui->qtVersionLabel, &QLabel::linkActivated,
this, &AboutDialog::linkActivated);
103 centerWidget(
this, parentWidget());
AboutDialog(QWidget *parent, const QString &applicationName, const QString &creator, const QString &version, const QString &website=QString(), const QString &description=QString(), const QImage &image=QImage())
Constructs an about dialog with the specified information.