@@ -52,6 +52,7 @@ static constexpr Qt::SortOrder DEFAULT_SORT_ORDER = Qt::AscendingOrder;
5252static constexpr std::array<int , GameListModel::Column_Count> DEFAULT_COLUMN_WIDTHS = {{
5353 55 , // type
5454 85 , // code
55+ 95 , // favorite
5556 -1 , // title
5657 -1 , // file title
5758 75 , // crc
@@ -61,7 +62,6 @@ static constexpr std::array<int, GameListModel::Column_Count> DEFAULT_COLUMN_WID
6162 60 , // region
6263 120 , // compatibility
6364 -1 , // cover
64- 50 // favorite
6565}};
6666static_assert (static_cast <int >(DEFAULT_COLUMN_WIDTHS.size()) <= GameListModel::Column_Count,
6767 " Game List: More default column widths than column types." );
@@ -135,10 +135,13 @@ namespace
135135 class GameListIconStyleDelegate final : public QStyledItemDelegate
136136 {
137137 public:
138+ static constexpr int STAR_SIZE = 22 ;
139+ static constexpr int STAR_MARGIN = 4 ;
140+
138141 GameListIconStyleDelegate (QWidget* parent)
139142 : QStyledItemDelegate(parent)
140143 {
141- m_star_pixmap = QIcon (QStringLiteral (" %1/icons/star-fill.svg" ).arg (QtHost::GetResourcesBasePath ())).pixmap (QSize (22 , 22 ));
144+ m_star_pixmap = QIcon (QStringLiteral (" %1/icons/star-fill.svg" ).arg (QtHost::GetResourcesBasePath ())).pixmap (QSize (STAR_SIZE, STAR_SIZE ));
142145 }
143146 ~GameListIconStyleDelegate () = default ;
144147
@@ -203,8 +206,6 @@ namespace
203206 const bool is_favorite = index.data (Qt::UserRole).toBool ();
204207 if (is_favorite)
205208 {
206- static constexpr int STAR_SIZE = 22 ;
207- static constexpr int STAR_MARGIN = 4 ;
208209 const QPoint star_pos = rect.bottomRight () - QPoint (STAR_SIZE + STAR_MARGIN, STAR_SIZE + STAR_MARGIN);
209210 painter->drawPixmap (star_pos, m_star_pixmap);
210211 }
@@ -288,9 +289,9 @@ void GameListWidget::initialize()
288289 m_table_view->setVerticalScrollMode (QAbstractItemView::ScrollMode::ScrollPerPixel);
289290
290291 // Custom painter to center-align DisplayRoles (icons)
291- m_table_view->setItemDelegateForColumn (0 , new GameListIconStyleDelegate (this ));
292- m_table_view->setItemDelegateForColumn (8 , new GameListIconStyleDelegate (this ));
293- m_table_view->setItemDelegateForColumn (9 , new GameListIconStyleDelegate (this ));
292+ m_table_view->setItemDelegateForColumn (static_cast < int >(GameListModel::Column_Type) , new GameListIconStyleDelegate (this ));
293+ m_table_view->setItemDelegateForColumn (static_cast < int >(GameListModel::Column_Region) , new GameListIconStyleDelegate (this ));
294+ m_table_view->setItemDelegateForColumn (static_cast < int >(GameListModel::Column_Compatibility) , new GameListIconStyleDelegate (this ));
294295 m_table_view->setItemDelegateForColumn (static_cast <int >(GameListModel::Column_Favorite), new GameListIconStyleDelegate (this ));
295296
296297 connect (m_table_view->selectionModel (), &QItemSelectionModel::currentChanged, this ,
@@ -805,6 +806,7 @@ void GameListWidget::resizeTableViewColumnsToFit()
805806 QtUtils::ResizeColumnsForTableView (m_table_view, {
806807 DEFAULT_COLUMN_WIDTHS[GameListModel::Column_Type],
807808 DEFAULT_COLUMN_WIDTHS[GameListModel::Column_Serial],
809+ DEFAULT_COLUMN_WIDTHS[GameListModel::Column_Favorite],
808810 DEFAULT_COLUMN_WIDTHS[GameListModel::Column_Title],
809811 DEFAULT_COLUMN_WIDTHS[GameListModel::Column_FileTitle],
810812 DEFAULT_COLUMN_WIDTHS[GameListModel::Column_CRC],
0 commit comments