mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Qt: fix table item delegate usage
This commit is contained in:
parent
f932cc4073
commit
a6e4b77273
8 changed files with 67 additions and 38 deletions
41
rpcs3/rpcs3qt/game_list_delegate.cpp
Normal file
41
rpcs3/rpcs3qt/game_list_delegate.cpp
Normal file
|
|
@ -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<const QTableWidget*>(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<movie_item*>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue