diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj
index 5ddf3bc98174..476f5457b719 100644
--- a/rpcs3/rpcs3.vcxproj
+++ b/rpcs3/rpcs3.vcxproj
@@ -671,6 +671,7 @@
+
@@ -1158,6 +1159,7 @@
$(QTDIR)\bin\moc.exe;%(FullPath)
$(QTDIR)\bin\moc.exe;%(FullPath)
+
$(QTDIR)\bin\moc.exe;%(FullPath)
diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters
index 7460608f6116..080136e8dec5 100644
--- a/rpcs3/rpcs3.vcxproj.filters
+++ b/rpcs3/rpcs3.vcxproj.filters
@@ -941,12 +941,16 @@
Gui\custom items
+
Generated Files\Debug
Generated Files\Release
+
+ Gui\game list
+
@@ -1117,6 +1121,9 @@
Gui\progress
+
+ Gui\game list
+
diff --git a/rpcs3/rpcs3qt/CMakeLists.txt b/rpcs3/rpcs3qt/CMakeLists.txt
index 09d1a4fa495c..f6cb29851137 100644
--- a/rpcs3/rpcs3qt/CMakeLists.txt
+++ b/rpcs3/rpcs3qt/CMakeLists.txt
@@ -24,6 +24,7 @@ set(SRC_FILES
find_dialog.cpp
game_compatibility.cpp
game_list.cpp
+ game_list_delegate.cpp
game_list_frame.cpp
game_list_grid.cpp
game_list_grid_delegate.cpp
diff --git a/rpcs3/rpcs3qt/game_list_delegate.cpp b/rpcs3/rpcs3qt/game_list_delegate.cpp
new file mode 100644
index 000000000000..1a0d9b964edc
--- /dev/null
+++ b/rpcs3/rpcs3qt/game_list_delegate.cpp
@@ -0,0 +1,41 @@
+#include "game_list_delegate.h"
+#include "movie_item.h"
+#include "gui_settings.h"
+
+game_list_delegate::game_list_delegate(QObject* parent)
+ : table_item_delegate(parent, true)
+{}
+
+void game_list_delegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+ table_item_delegate::paint(painter, option, index);
+
+ // Find out if the icon or size items are visible
+ if (index.column() == gui::game_list_columns::column_dir_size || (m_has_icons && index.column() == gui::game_list_columns::column_icon))
+ {
+ if (const QTableWidget* table = static_cast(parent()))
+ {
+ if (const QTableWidgetItem* current_item = table->item(index.row(), index.column());
+ current_item && table->visibleRegion().intersects(table->visualItemRect(current_item)))
+ {
+ if (movie_item* item = static_cast(table->item(index.row(), gui::game_list_columns::column_icon)))
+ {
+ if (index.column() == gui::game_list_columns::column_dir_size)
+ {
+ if (!item->size_on_disk_loading())
+ {
+ item->call_size_calc_func();
+ }
+ }
+ else if (m_has_icons && index.column() == gui::game_list_columns::column_icon)
+ {
+ if (!item->icon_loading())
+ {
+ item->call_icon_load_func();
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/rpcs3/rpcs3qt/game_list_delegate.h b/rpcs3/rpcs3qt/game_list_delegate.h
new file mode 100644
index 000000000000..60d818625e53
--- /dev/null
+++ b/rpcs3/rpcs3qt/game_list_delegate.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "table_item_delegate.h"
+
+class game_list_delegate : public table_item_delegate
+{
+public:
+ explicit game_list_delegate(QObject* parent);
+
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
+};
diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp
index 25789979cbd3..968bc1ccea42 100644
--- a/rpcs3/rpcs3qt/game_list_frame.cpp
+++ b/rpcs3/rpcs3qt/game_list_frame.cpp
@@ -2,7 +2,7 @@
#include "qt_utils.h"
#include "settings_dialog.h"
#include "pad_settings_dialog.h"
-#include "table_item_delegate.h"
+#include "game_list_delegate.h"
#include "custom_table_widget_item.h"
#include "input_dialog.h"
#include "localized.h"
@@ -81,7 +81,7 @@ game_list_frame::game_list_frame(std::shared_ptr gui_settings, std
m_game_list = new game_list();
m_game_list->setShowGrid(false);
- m_game_list->setItemDelegate(new table_item_delegate(m_game_list, true));
+ m_game_list->setItemDelegate(new game_list_delegate(m_game_list));
m_game_list->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_game_list->setSelectionBehavior(QAbstractItemView::SelectRows);
m_game_list->setSelectionMode(QAbstractItemView::SingleSelection);
diff --git a/rpcs3/rpcs3qt/table_item_delegate.cpp b/rpcs3/rpcs3qt/table_item_delegate.cpp
index 59e37bf7aa54..d401bf8e4254 100644
--- a/rpcs3/rpcs3qt/table_item_delegate.cpp
+++ b/rpcs3/rpcs3qt/table_item_delegate.cpp
@@ -1,7 +1,4 @@
#include "table_item_delegate.h"
-
-#include
-#include "movie_item.h"
#include "gui_settings.h"
table_item_delegate::table_item_delegate(QObject* parent, bool has_icons)
@@ -29,40 +26,11 @@ void table_item_delegate::initStyleOption(QStyleOptionViewItem *option, const QM
void table_item_delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- if (index.column() == gui::game_list_columns::column_icon && option.state & QStyle::State_Selected)
+ if (m_has_icons && index.column() == gui::game_list_columns::column_icon && option.state & QStyle::State_Selected)
{
// Add background highlight color to icons
painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
}
QStyledItemDelegate::paint(painter, option, index);
-
- // Find out if the icon or size items are visible
- if (index.column() == gui::game_list_columns::column_dir_size || (m_has_icons && index.column() == gui::game_list_columns::column_icon))
- {
- if (const QTableWidget* table = static_cast(parent()))
- {
- if (const QTableWidgetItem* current_item = table->item(index.row(), index.column());
- current_item && table->visibleRegion().intersects(table->visualItemRect(current_item)))
- {
- if (movie_item* item = static_cast(table->item(index.row(), gui::game_list_columns::column_icon)))
- {
- if (index.column() == gui::game_list_columns::column_dir_size)
- {
- if (!item->size_on_disk_loading())
- {
- item->call_size_calc_func();
- }
- }
- else if (m_has_icons && index.column() == gui::game_list_columns::column_icon)
- {
- if (!item->icon_loading())
- {
- item->call_icon_load_func();
- }
- }
- }
- }
- }
- }
}
diff --git a/rpcs3/rpcs3qt/table_item_delegate.h b/rpcs3/rpcs3qt/table_item_delegate.h
index d6a29484b428..0d500c45e35f 100644
--- a/rpcs3/rpcs3qt/table_item_delegate.h
+++ b/rpcs3/rpcs3qt/table_item_delegate.h
@@ -6,13 +6,13 @@
/** This class is used to get rid of somewhat ugly item focus rectangles. You could change the rectangle instead of omiting it if you wanted */
class table_item_delegate : public QStyledItemDelegate
{
-private:
- bool m_has_icons;
-
public:
explicit table_item_delegate(QObject *parent = nullptr, bool has_icons = false);
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+
+protected:
+ bool m_has_icons{};
};