mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
Fixes ghost text, larger image, black text in light theme
This commit is contained in:
parent
a7f506fa93
commit
1d850e2f91
@ -6,7 +6,9 @@
|
|||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <cmrc/cmrc.hpp>
|
#include <cmrc/cmrc.hpp>
|
||||||
|
#include <common/config.h>
|
||||||
#include "common/path_util.h"
|
#include "common/path_util.h"
|
||||||
|
#include "main_window_themes.h"
|
||||||
#include "trophy_viewer.h"
|
#include "trophy_viewer.h"
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
@ -303,8 +305,8 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||||||
imgdata = std::vector<char>(file.begin(), file.end());
|
imgdata = std::vector<char>(file.begin(), file.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage type_icon = QImage::fromData(imgdata).scaled(QSize(64, 64), Qt::KeepAspectRatio,
|
QImage type_icon = QImage::fromData(imgdata).scaled(
|
||||||
Qt::SmoothTransformation);
|
QSize(128, 128), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
typeitem->setData(Qt::DecorationRole, type_icon);
|
typeitem->setData(Qt::DecorationRole, type_icon);
|
||||||
typeitem->setFlags(typeitem->flags() & ~Qt::ItemIsEditable);
|
typeitem->setFlags(typeitem->flags() & ~Qt::ItemIsEditable);
|
||||||
tableWidget->setItem(row, 6, typeitem);
|
tableWidget->setItem(row, 6, typeitem);
|
||||||
@ -342,31 +344,18 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TrophyViewer::SetTableItem(QTableWidget* parent, int row, int column, QString str) {
|
void TrophyViewer::SetTableItem(QTableWidget* parent, int row, int column, QString str) {
|
||||||
QWidget* widget = new QWidget();
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
|
||||||
QLabel* label = new QLabel(str);
|
|
||||||
|
|
||||||
label->setWordWrap(true);
|
|
||||||
label->setStyleSheet("color: white; font-size: 15px; font-weight: bold;");
|
|
||||||
|
|
||||||
// Create shadow effect
|
|
||||||
QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect();
|
|
||||||
shadowEffect->setBlurRadius(5); // Set the blur radius of the shadow
|
|
||||||
shadowEffect->setColor(QColor(0, 0, 0, 160)); // Set the color and opacity of the shadow
|
|
||||||
shadowEffect->setOffset(2, 2); // Set the offset of the shadow
|
|
||||||
|
|
||||||
label->setGraphicsEffect(shadowEffect); // Apply shadow effect to the QLabel
|
|
||||||
|
|
||||||
layout->addWidget(label);
|
|
||||||
if (column != 1 && column != 2 && column != 3)
|
|
||||||
layout->setAlignment(Qt::AlignCenter);
|
|
||||||
widget->setLayout(layout);
|
|
||||||
parent->setCellWidget(row, column, widget);
|
|
||||||
QTableWidgetItem* item = new QTableWidgetItem(str);
|
QTableWidgetItem* item = new QTableWidgetItem(str);
|
||||||
|
if (column != 1 && column != 2 && column != 3)
|
||||||
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
|
item->setFont(QFont("Arial", 12, QFont::Bold));
|
||||||
|
|
||||||
// Make QTableWidgetItem text invisible
|
Theme theme = static_cast<Theme>(Config::getMainWindowTheme());
|
||||||
item->setForeground(Qt::transparent);
|
|
||||||
// Set item in cell (but text will be invisible)
|
if (theme == Theme::Light) {
|
||||||
parent->setItem(row, column, item);
|
item->setForeground(QBrush(Qt::black));
|
||||||
// TODO: improve this workaround :)
|
} else {
|
||||||
|
item->setForeground(QBrush(Qt::white));
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->setItem(row, column, item);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user