Qt: Add close button to "About" dialog

And fix title font size on macOS.
This commit is contained in:
Davide Pesavento
2025-11-29 19:56:03 -05:00
committed by Connor McLaughlin
parent d106639619
commit 9fa42e2f61
2 changed files with 37 additions and 64 deletions

View File

@@ -28,12 +28,13 @@ AboutDialog::AboutDialog(QWidget* parent /* = nullptr */) : QDialog(parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setFixedSize(geometry().width(), geometry().height());
m_ui.scmversion->setTextInteractionFlags(Qt::TextSelectableByMouse);
QFont title_font(m_ui.title->font());
title_font.setPixelSize(20);
m_ui.title->setFont(title_font);
m_ui.scmversion->setText(
tr("%1 (%2)").arg(QLatin1StringView(g_scm_tag_str)).arg(QLatin1StringView(g_scm_branch_str)));
m_ui.description->setTextInteractionFlags(Qt::TextBrowserInteraction);
m_ui.description->setOpenExternalLinks(true);
m_ui.description->setText(QStringLiteral(R"(
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
@@ -53,6 +54,8 @@ p, li { white-space: pre-wrap; }
.arg(tr("and other contributors"))
.arg(tr("Icon by"))
.arg(tr("License")));
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::accept);
}
AboutDialog::~AboutDialog() = default;

View File

@@ -13,61 +13,24 @@
<property name="windowTitle">
<string>About DuckStation</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="iconWidget" native="true">
<layout class="QVBoxLayout" name="iconLayout">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="icon">
<property name="maximumSize">
<size>
<width>260</width>
<height>260</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="iconSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>156</height>
</size>
</property>
</spacer>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="icon">
<property name="maximumSize">
<size>
<width>260</width>
<height>260</height>
</size>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignHCenter|Qt::AlignmentFlag::AlignTop</set>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="textLayout">
<property name="spacing">
<number>9</number>
@@ -86,12 +49,6 @@
</property>
<item>
<widget class="QLabel" name="title">
<property name="font">
<font>
<pointsize>14</pointsize>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>DuckStation</string>
</property>
@@ -99,8 +56,8 @@
</item>
<item>
<widget class="QLabel" name="scmversion">
<property name="text">
<string/>
<property name="textInteractionFlags">
<set>Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property>
</widget>
</item>
@@ -109,10 +66,23 @@
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextInteractionFlag::TextBrowserInteraction</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>