mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
Qt: fix type mismatch crash of game grid items
This commit is contained in:
parent
266c4209c4
commit
bdac1d9bfd
7 changed files with 20 additions and 10 deletions
|
@ -1,6 +1,13 @@
|
||||||
#include "game_list.h"
|
#include "game_list.h"
|
||||||
#include "movie_item.h"
|
#include "movie_item.h"
|
||||||
|
|
||||||
|
void game_list::clear_list()
|
||||||
|
{
|
||||||
|
m_last_hover_item = nullptr;
|
||||||
|
clearSelection();
|
||||||
|
clearContents();
|
||||||
|
}
|
||||||
|
|
||||||
void game_list::mousePressEvent(QMouseEvent *event)
|
void game_list::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!indexAt(event->pos()).isValid() || !itemAt(event->pos())->data(Qt::UserRole).isValid())
|
if (!indexAt(event->pos()).isValid() || !itemAt(event->pos())->data(Qt::UserRole).isValid())
|
||||||
|
|
|
@ -31,6 +31,9 @@ class movie_item;
|
||||||
*/
|
*/
|
||||||
class game_list : public QTableWidget
|
class game_list : public QTableWidget
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
void clear_list(); // Use this instead of clearContents
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
movie_item* m_last_hover_item = nullptr;
|
movie_item* m_last_hover_item = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -2091,8 +2091,7 @@ void game_list_frame::PopulateGameList()
|
||||||
|
|
||||||
const std::string selected_item = CurrentSelectionPath();
|
const std::string selected_item = CurrentSelectionPath();
|
||||||
|
|
||||||
m_game_list->clearSelection();
|
m_game_list->clear_list();
|
||||||
m_game_list->clearContents();
|
|
||||||
m_game_list->setRowCount(m_game_data.size());
|
m_game_list->setRowCount(m_game_data.size());
|
||||||
|
|
||||||
// Default locale. Uses current Qt application language.
|
// Default locale. Uses current Qt application language.
|
||||||
|
@ -2296,7 +2295,7 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
const QString title = m_titles.value(serial, qstr(app->info.name));
|
const QString title = m_titles.value(serial, qstr(app->info.name));
|
||||||
const QString notes = m_notes.value(serial);
|
const QString notes = m_notes.value(serial);
|
||||||
|
|
||||||
QTableWidgetItem* item = m_game_grid->addItem(app, title, (m_play_hover_movies && app->has_hover_gif) ? (game_icon_path % serial % "/hover.gif") : QStringLiteral(""), r, c);
|
movie_item* item = m_game_grid->addItem(app, title, (m_play_hover_movies && app->has_hover_gif) ? (game_icon_path % serial % "/hover.gif") : QStringLiteral(""), r, c);
|
||||||
ensure(item);
|
ensure(item);
|
||||||
item->setData(gui::game_role, QVariant::fromValue(app));
|
item->setData(gui::game_role, QVariant::fromValue(app));
|
||||||
|
|
||||||
|
@ -2325,9 +2324,9 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
{ // if left over games exist -- if empty entries exist
|
{ // if left over games exist -- if empty entries exist
|
||||||
for (int col = c; col < maxCols; ++col)
|
for (int col = c; col < maxCols; ++col)
|
||||||
{
|
{
|
||||||
QTableWidgetItem* emptyItem = new QTableWidgetItem();
|
movie_item* empty_item = new movie_item();
|
||||||
emptyItem->setFlags(Qt::NoItemFlags);
|
empty_item->setFlags(Qt::NoItemFlags);
|
||||||
m_game_grid->setItem(r, col, emptyItem);
|
m_game_grid->setItem(r, col, empty_item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ void game_list_grid::setIconSize(const QSize& size) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableWidgetItem* game_list_grid::addItem(const game_info& app, const QString& name, const QString& movie_path, const int& row, const int& col)
|
movie_item* game_list_grid::addItem(const game_info& app, const QString& name, const QString& movie_path, const int& row, const int& col)
|
||||||
{
|
{
|
||||||
// create item with expanded image, title and position
|
// create item with expanded image, title and position
|
||||||
movie_item* item = new movie_item;
|
movie_item* item = new movie_item;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
void enableText(const bool& enabled);
|
void enableText(const bool& enabled);
|
||||||
void setIconSize(const QSize& size) const;
|
void setIconSize(const QSize& size) const;
|
||||||
QTableWidgetItem* addItem(const game_info& app, const QString& name, const QString& movie_path, const int& row, const int& col);
|
movie_item* addItem(const game_info& app, const QString& name, const QString& movie_path, const int& row, const int& col);
|
||||||
|
|
||||||
[[nodiscard]] qreal getMarginFactor() const;
|
[[nodiscard]] qreal getMarginFactor() const;
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,7 @@ void trophy_manager_dialog::PopulateTrophyTable()
|
||||||
|
|
||||||
m_game_progress->setText(tr("Progress: %1% (%2/%3)").arg(percentage).arg(unlocked_trophies).arg(all_trophies));
|
m_game_progress->setText(tr("Progress: %1% (%2/%3)").arg(percentage).arg(unlocked_trophies).arg(all_trophies));
|
||||||
|
|
||||||
m_trophy_table->clearContents();
|
m_trophy_table->clear_list();
|
||||||
m_trophy_table->setRowCount(all_trophies);
|
m_trophy_table->setRowCount(all_trophies);
|
||||||
m_trophy_table->setSortingEnabled(false); // Disable sorting before using setItem calls
|
m_trophy_table->setSortingEnabled(false); // Disable sorting before using setItem calls
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
class game_list;
|
||||||
class gui_settings;
|
class gui_settings;
|
||||||
class TROPUSRLoader;
|
class TROPUSRLoader;
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ private:
|
||||||
QComboBox* m_game_combo; //! Lets you choose a game
|
QComboBox* m_game_combo; //! Lets you choose a game
|
||||||
QLabel* m_game_progress; //! Shows you the current game's progress
|
QLabel* m_game_progress; //! Shows you the current game's progress
|
||||||
QSplitter* m_splitter; //! Contains the game and trophy tables
|
QSplitter* m_splitter; //! Contains the game and trophy tables
|
||||||
QTableWidget* m_trophy_table; //! UI element to display trophy stuff.
|
game_list* m_trophy_table; //! UI element to display trophy stuff.
|
||||||
QTableWidget* m_game_table; //! UI element to display games.
|
QTableWidget* m_game_table; //! UI element to display games.
|
||||||
|
|
||||||
bool m_show_hidden_trophies = false;
|
bool m_show_hidden_trophies = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue