mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
stylesheets: fix gamegrid font
This commit is contained in:
parent
0020359b8f
commit
e668ecd453
4 changed files with 17 additions and 9 deletions
|
@ -291,6 +291,7 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
|||
"QWidget#header_section { background-color: #ffffff; }"
|
||||
"QLineEdit#mw_searchbar { margin-left:14px; }"
|
||||
"QLineEdit#tb_searchbar { background: transparent; }"
|
||||
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
|
||||
);
|
||||
}
|
||||
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "game_list_grid_delegate.h"
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
|
||||
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(), m_icon_size(icon_size), m_icon_color(icon_color), m_margin_factor(margin_factor), m_text_factor(text_factor), m_text_enabled(showText)
|
||||
|
@ -16,7 +17,14 @@ game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color,
|
|||
item_size = m_icon_size + m_icon_size * m_margin_factor * 2;
|
||||
}
|
||||
|
||||
grid_item_delegate = new game_list_grid_delegate(item_size, m_margin_factor, m_text_factor, this);
|
||||
// font by stylesheet
|
||||
QLabel font_dummy;
|
||||
font_dummy.setObjectName("gamegrid_font");
|
||||
font_dummy.ensurePolished();
|
||||
QFont font = font_dummy.font();
|
||||
QColor font_color = font_dummy.palette().color(QPalette::Foreground);
|
||||
|
||||
grid_item_delegate = new game_list_grid_delegate(item_size, m_margin_factor, m_text_factor, font, font_color, this);
|
||||
setItemDelegate(grid_item_delegate);
|
||||
setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
|
|
@ -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, QObject *parent)
|
||||
: QAbstractItemDelegate(parent), m_size(size), m_margin_factor(margin_factor), m_text_factor(text_factor)
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,6 @@ void game_list_grid_delegate::paint(QPainter * painter, const QStyleOptionViewIt
|
|||
|
||||
painter->eraseRect(r);
|
||||
|
||||
//Color: #333
|
||||
QPen fontPen(QColor::fromRgb(51, 51, 51), 1, Qt::SolidLine);
|
||||
|
||||
//Get title and image
|
||||
QPixmap image = (qvariant_cast<QPixmap>(index.data(Qt::DecorationRole)));
|
||||
QString title = index.data(Qt::DisplayRole).toString();
|
||||
|
@ -43,8 +40,8 @@ void game_list_grid_delegate::paint(QPainter * painter, const QStyleOptionViewIt
|
|||
int top = r.bottom() - height;
|
||||
|
||||
// title
|
||||
painter->setPen(fontPen);
|
||||
painter->setFont(QFont("Lucida Grande", 8, QFont::DemiBold));
|
||||
painter->setPen(QPen(m_font_color, 1, Qt::SolidLine));
|
||||
painter->setFont(m_font);
|
||||
painter->drawText(QRect(r.left(), top, r.width(), height), Qt::TextWordWrap | Qt::AlignCenter, title);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class game_list_grid_delegate : public QAbstractItemDelegate
|
||||
{
|
||||
public:
|
||||
game_list_grid_delegate(const QSize& imageSize, const qreal& margin_factor, const qreal& margin_ratio, QObject *parent = 0);
|
||||
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);
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
|
@ -16,4 +16,6 @@ private:
|
|||
QSize m_size;
|
||||
qreal m_margin_factor;
|
||||
qreal m_text_factor;
|
||||
QFont m_font;
|
||||
QColor m_font_color;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue