mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-19 16:21:30 +00:00
Qt: temporary game grid selection color adjustment
This commit is contained in:
parent
01dc09c436
commit
ff9024ae70
@ -909,7 +909,7 @@ bool game_list_frame::DeleteSPUCache(const std::string& base_dir, bool is_intera
|
||||
return true;
|
||||
}
|
||||
|
||||
QPixmap game_list_frame::PaintedPixmap(const QImage& img, bool paintConfigIcon)
|
||||
QPixmap game_list_frame::PaintedPixmap(const QImage& img, bool paint_config_icon)
|
||||
{
|
||||
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
|
||||
scaled.fill(m_Icon_Color);
|
||||
@ -921,7 +921,7 @@ QPixmap game_list_frame::PaintedPixmap(const QImage& img, bool paintConfigIcon)
|
||||
painter.drawImage(QPoint(0, 0), img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
|
||||
}
|
||||
|
||||
if (paintConfigIcon && !m_isListLayout)
|
||||
if (paint_config_icon && !m_isListLayout)
|
||||
{
|
||||
int width = m_Icon_Size.width() * 0.2;
|
||||
QPoint origin = QPoint(m_Icon_Size.width() - width, 0);
|
||||
|
@ -228,7 +228,7 @@ protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
private:
|
||||
QPixmap PaintedPixmap(const QImage& img, bool paintConfigIcon = false);
|
||||
QPixmap PaintedPixmap(const QImage& img, bool paint_config_icon = false);
|
||||
void ShowCustomConfigIcon(QTableWidgetItem* item, bool enabled);
|
||||
void PopulateGameGrid(int maxCols, const QSize& image_size, const QColor& image_color);
|
||||
bool IsEntryVisible(const game_info& game);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "game_list_grid_delegate.h"
|
||||
|
||||
game_list_grid_delegate::game_list_grid_delegate(const QSize& size, const qreal& margin_factor, const qreal& text_factor, const QFont& font, const QColor& font_color, QObject *parent)
|
||||
: QAbstractItemDelegate(parent), m_size(size), m_margin_factor(margin_factor), m_text_factor(text_factor), m_font(font), m_font_color(font_color)
|
||||
: QStyledItemDelegate(parent), m_size(size), m_margin_factor(margin_factor), m_text_factor(text_factor), m_font(font), m_font_color(font_color)
|
||||
{
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ void game_list_grid_delegate::paint(QPainter * painter, const QStyleOptionViewIt
|
||||
|
||||
painter->eraseRect(r);
|
||||
|
||||
//Get title and image
|
||||
QPixmap image = (qvariant_cast<QPixmap>(index.data(Qt::DecorationRole)));
|
||||
// Get title and image
|
||||
QPixmap image = qvariant_cast<QPixmap>(index.data(Qt::DecorationRole));
|
||||
QString title = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
// image
|
||||
@ -28,11 +28,7 @@ void game_list_grid_delegate::paint(QPainter * painter, const QStyleOptionViewIt
|
||||
// Add selection overlay
|
||||
if (option.state & QStyle::State_Selected)
|
||||
{
|
||||
QLinearGradient gradientSelected(r.left(), r.top(), r.left(), r.height() + r.top());
|
||||
gradientSelected.setColorAt(0.0, QColor::fromRgba(qRgba(119, 213, 247, 128)));
|
||||
gradientSelected.setColorAt(0.9, QColor::fromRgba(qRgba(27, 134, 183, 128)));
|
||||
gradientSelected.setColorAt(1.0, QColor::fromRgba(qRgba(0, 120, 174, 128)));
|
||||
painter->fillRect(r, gradientSelected);
|
||||
painter->fillRect(r, QColor(20, 138, 255, 128));
|
||||
}
|
||||
|
||||
int h = r.height() / (1 + m_margin_factor + m_margin_factor*m_text_factor);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPainter>
|
||||
#include <QAbstractItemDelegate>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class game_list_grid_delegate : public QAbstractItemDelegate
|
||||
class game_list_grid_delegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
game_list_grid_delegate(const QSize& imageSize, const qreal& margin_factor, const qreal& margin_ratio, const QFont& font, const QColor& font_color, QObject *parent = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user