From 54444475f52fad1707d7fcc801d7b7536e8a7737 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 18 May 2025 13:33:21 +1000 Subject: [PATCH] Qt: Fix sizing of patch detail widgets --- src/duckstation-qt/gamepatchdetailswidget.ui | 112 +++++++----------- .../gamepatchsettingswidget.cpp | 17 ++- src/duckstation-qt/gamepatchsettingswidget.ui | 9 +- 3 files changed, 65 insertions(+), 73 deletions(-) diff --git a/src/duckstation-qt/gamepatchdetailswidget.ui b/src/duckstation-qt/gamepatchdetailswidget.ui index 13dad3381..06fe901b3 100644 --- a/src/duckstation-qt/gamepatchdetailswidget.ui +++ b/src/duckstation-qt/gamepatchdetailswidget.ui @@ -6,82 +6,44 @@ 0 0 - 541 - 112 + 480 + 92 - + 0 0 - - - - - - - - 0 - 0 - - - - - 12 - true - - - - Patch Title - - - true - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - - Enabled - - - - - - - Qt::Orientation::Vertical - - - - 20 - 0 - - - - - - - + + + 480 + 0 + + + + + + + Enabled + + - + + + + 0 + 0 + + + + + 480 + 0 + + <html><head/><body><p><span style=" font-weight:700;">Author: </span>Patch Author</p><p>Description would go here</p></body></html> @@ -93,6 +55,22 @@ + + + + + 0 + 0 + + + + Patch Title + + + true + + + diff --git a/src/duckstation-qt/gamepatchsettingswidget.cpp b/src/duckstation-qt/gamepatchsettingswidget.cpp index 0c01278aa..beb1adbdb 100644 --- a/src/duckstation-qt/gamepatchsettingswidget.cpp +++ b/src/duckstation-qt/gamepatchsettingswidget.cpp @@ -21,7 +21,11 @@ GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::stri { m_ui.setupUi(this); + QFont title_font(m_ui.name->font()); + title_font.setPointSizeF(title_font.pointSizeF() + 4.0f); + title_font.setBold(true); m_ui.name->setText(QString::fromStdString(name)); + m_ui.name->setFont(title_font); m_ui.description->setText( tr("Author: %1%2
%3") .arg(author.empty() ? tr("Unknown") : QString::fromStdString(author)) @@ -88,11 +92,14 @@ void GamePatchSettingsWidget::reloadList() delete m_ui.scrollArea->takeWidget(); QWidget* container = new QWidget(m_ui.scrollArea); + m_ui.scrollArea->setWidget(container); + QVBoxLayout* layout = new QVBoxLayout(container); - layout->setContentsMargins(0, 0, 0, 0); if (!patches.empty()) { + layout->setContentsMargins(0, 0, 0, 0); + bool first = true; for (Cheats::CodeInfo& pi : patches) @@ -117,9 +124,13 @@ void GamePatchSettingsWidget::reloadList() } else { - QLabel* label = new QLabel(tr("There are no patches available for this game."), container); + QLabel* label = new QLabel(tr("No patches are available for this game."), container); + QFont font(label->font()); + font.setPointSizeF(font.pointSizeF() + 2.0f); + font.setBold(true); + label->setFont(font); layout->addWidget(label); } - m_ui.scrollArea->setWidget(container); + layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); } diff --git a/src/duckstation-qt/gamepatchsettingswidget.ui b/src/duckstation-qt/gamepatchsettingswidget.ui index 134d20555..bfe4a6a13 100644 --- a/src/duckstation-qt/gamepatchsettingswidget.ui +++ b/src/duckstation-qt/gamepatchsettingswidget.ui @@ -7,7 +7,7 @@ 0 0 766 - 392 + 200 @@ -28,6 +28,9 @@ Qt::ScrollBarPolicy::ScrollBarAlwaysOff + + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents + true @@ -49,8 +52,8 @@ - 40 - 20 + 0 + 0