mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 11:13:19 +01:00
game_list: enable deselection + fix entry selection
This commit is contained in:
parent
d410494a7d
commit
2cd5f63284
20
rpcs3/game_list.h
Normal file
20
rpcs3/game_list.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
/*
|
||||||
|
class used in order to get deselection
|
||||||
|
if you know a simpler way, tell @Megamouse
|
||||||
|
*/
|
||||||
|
class game_list : public QTableWidget {
|
||||||
|
private:
|
||||||
|
void mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (!indexAt(event->pos()).isValid())
|
||||||
|
{
|
||||||
|
clearSelection();
|
||||||
|
}
|
||||||
|
QTableWidget::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
};
|
@ -924,6 +924,7 @@
|
|||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<ClInclude Include="ds4_pad_handler.h" />
|
<ClInclude Include="ds4_pad_handler.h" />
|
||||||
|
<ClInclude Include="game_list.h" />
|
||||||
<ClInclude Include="keyboard_pad_handler.h" />
|
<ClInclude Include="keyboard_pad_handler.h" />
|
||||||
<CustomBuild Include="rpcs3qt\gs_frame.h">
|
<CustomBuild Include="rpcs3qt\gs_frame.h">
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing gs_frame.h...</Message>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing gs_frame.h...</Message>
|
||||||
|
@ -514,6 +514,9 @@
|
|||||||
<ClInclude Include="QTGeneratedFiles\ui_welcome_dialog.h">
|
<ClInclude Include="QTGeneratedFiles\ui_welcome_dialog.h">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="game_list.h">
|
||||||
|
<Filter>Gui</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
||||||
|
@ -155,7 +155,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
|
|||||||
bool showText = (m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny);
|
bool showText = (m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny);
|
||||||
m_xgrid = new game_list_grid(m_Icon_Size, m_Icon_Color, m_Margin_Factor, m_Text_Factor, showText);
|
m_xgrid = new game_list_grid(m_Icon_Size, m_Icon_Color, m_Margin_Factor, m_Text_Factor, showText);
|
||||||
|
|
||||||
gameList = new QTableWidget();
|
gameList = new game_list();
|
||||||
gameList->setShowGrid(false);
|
gameList->setShowGrid(false);
|
||||||
gameList->setItemDelegate(new table_item_delegate(this));
|
gameList->setItemDelegate(new table_item_delegate(this));
|
||||||
gameList->setSelectionBehavior(QAbstractItemView::SelectRows);
|
gameList->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
@ -965,11 +965,11 @@ std::string game_list_frame::CurrentSelectionIconPath()
|
|||||||
std::string selection = "";
|
std::string selection = "";
|
||||||
|
|
||||||
// The index can be more than the size of m_game_data if you use the VFS to load a directory which has less games.
|
// The index can be more than the size of m_game_data if you use the VFS to load a directory which has less games.
|
||||||
if (m_oldLayoutIsList && gameList->currentRow() >= 0 && gameList->currentRow() < m_game_data.size())
|
if (m_oldLayoutIsList && gameList->selectedItems().count() && gameList->currentRow() < m_game_data.size())
|
||||||
{
|
{
|
||||||
selection = m_game_data.at(gameList->item(gameList->currentRow(), 0)->data(Qt::UserRole).toInt()).info.icon_path;
|
selection = m_game_data.at(gameList->item(gameList->currentRow(), 0)->data(Qt::UserRole).toInt()).info.icon_path;
|
||||||
}
|
}
|
||||||
else if (!m_oldLayoutIsList && m_xgrid->currentItem() != nullptr)
|
else if (!m_oldLayoutIsList && m_xgrid->selectedItems().count())
|
||||||
{
|
{
|
||||||
int ind = m_xgrid->currentItem()->data(Qt::UserRole).toInt();
|
int ind = m_xgrid->currentItem()->data(Qt::UserRole).toInt();
|
||||||
if (ind < m_game_data.size())
|
if (ind < m_game_data.size())
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/GameInfo.h"
|
#include "Emu/GameInfo.h"
|
||||||
|
|
||||||
|
#include "game_list.h"
|
||||||
#include "game_list_grid.h"
|
#include "game_list_grid.h"
|
||||||
#include "gui_settings.h"
|
#include "gui_settings.h"
|
||||||
#include "emu_settings.h"
|
#include "emu_settings.h"
|
||||||
@ -231,7 +232,7 @@ private:
|
|||||||
QToolBar* m_Tool_Bar;
|
QToolBar* m_Tool_Bar;
|
||||||
QLineEdit* m_Search_Bar;
|
QLineEdit* m_Search_Bar;
|
||||||
QSlider* m_Slider_Size;
|
QSlider* m_Slider_Size;
|
||||||
QTableWidget *gameList;
|
game_list* gameList;
|
||||||
game_list_grid* m_xgrid;
|
game_list_grid* m_xgrid;
|
||||||
|
|
||||||
// Actions regarding showing/hiding columns
|
// Actions regarding showing/hiding columns
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color, const qreal& margin_factor, const qreal& text_factor, const bool& showText)
|
game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color, const qreal& margin_factor, const qreal& text_factor, const bool& showText)
|
||||||
: QTableWidget(), m_icon_size(icon_size), m_icon_color(icon_color), m_margin_factor(margin_factor), m_text_factor(text_factor), m_text_enabled(showText)
|
: game_list(), m_icon_size(icon_size), m_icon_color(icon_color), m_margin_factor(margin_factor), m_text_factor(text_factor), m_text_enabled(showText)
|
||||||
{
|
{
|
||||||
QSize item_size;
|
QSize item_size;
|
||||||
if (m_text_enabled)
|
if (m_text_enabled)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "game_list.h"
|
||||||
#include "game_list_grid_delegate.h"
|
#include "game_list_grid_delegate.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -9,7 +10,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
|
||||||
class game_list_grid : public QTableWidget
|
class game_list_grid : public game_list
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user