From 126171f5deeea0d8039ca5ee024f68a7189aa0b9 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 1 Sep 2025 19:36:02 +1000 Subject: [PATCH] Qt: Fix memory card icons drawing on themselves Also disable column title highlighting, and fix the width of the icon column. --- src/duckstation-qt/memorycardeditorwindow.cpp | 8 ++++---- src/duckstation-qt/memorycardeditorwindow.ui | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/duckstation-qt/memorycardeditorwindow.cpp b/src/duckstation-qt/memorycardeditorwindow.cpp index b91d2046b..6d1a62865 100644 --- a/src/duckstation-qt/memorycardeditorwindow.cpp +++ b/src/duckstation-qt/memorycardeditorwindow.cpp @@ -57,8 +57,8 @@ public: if (const QPixmap* icon_frame = getIconFrame(static_cast(index.row()), m_current_frame_index, rc)) { // center the icon in the available space - const int x = std::max((rc.width() - MEMORY_CARD_ICON_SIZE) / 2, 0); - const int y = std::max((rc.height() - MEMORY_CARD_ICON_SIZE) / 2, 0); + const int x = rc.x() + std::max((rc.width() - MEMORY_CARD_ICON_SIZE) / 2, 0); + const int y = rc.y() + std::max((rc.height() - MEMORY_CARD_ICON_SIZE) / 2, 0); painter->drawPixmap(x, y, *icon_frame); } } @@ -143,8 +143,8 @@ MemoryCardEditorWindow::MemoryCardEditorWindow() : QWidget() m_card_b.table = m_ui.cardB; m_card_b.blocks_free_label = m_ui.cardBUsage; - m_file_icon_width = MEMORY_CARD_ICON_SIZE + style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, this); - m_file_icon_height = MEMORY_CARD_ICON_SIZE + style()->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, this); + m_file_icon_width = MEMORY_CARD_ICON_SIZE + (m_card_a.table->showGrid() ? 1 : 0); + m_file_icon_height = MEMORY_CARD_ICON_SIZE + (m_card_a.table->showGrid() ? 1 : 0); QtUtils::SetColumnWidthsForTableView(m_card_a.table, {m_file_icon_width, -1, 155, 45}); QtUtils::SetColumnWidthsForTableView(m_card_b.table, {m_file_icon_width, -1, 155, 45}); diff --git a/src/duckstation-qt/memorycardeditorwindow.ui b/src/duckstation-qt/memorycardeditorwindow.ui index e3e110fbf..d25ac8428 100644 --- a/src/duckstation-qt/memorycardeditorwindow.ui +++ b/src/duckstation-qt/memorycardeditorwindow.ui @@ -29,6 +29,9 @@ QAbstractItemView::SelectionBehavior::SelectRows + + false + false @@ -180,6 +183,9 @@ QAbstractItemView::SelectionBehavior::SelectRows + + false + false