screenshot_manager: use stylesheets instead of hardcoded paintEvent

This commit is contained in:
Megamouse committed 2026-10-19 14:48:30 +02:00
1 parent 694c2177d8
commit fb43a4222d
16 files changed
+135 -47

No files matched your search

+8
View File
@@ -147,6 +147,14 @@ QLabel#l_controller {
color: #fff;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #0078D7; }
#screenshot_item:focus { background: #0078D7; }
#screenshot_item:hover { background: #008cff; }
#screenshot_item:hover:focus { background: #0078D7; }
/* Top menu bar (Workaround for transparent menus in Qt 6.7.3) */
QMenu {
color: #000;
@@ -370,5 +370,13 @@ QTreeView::branch:open:has-children:has-siblings:hover {
background-color: #0078D7;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #313f4e; }
#screenshot_item:focus { background: #0078D7; }
#screenshot_item:hover { background: #313f4e; }
#screenshot_item:hover:focus { background: #0078D7; }
/* Richtext link color */
QLabel#richtext_link_color { color: #87cefa; }
+8
View File
@@ -676,5 +676,13 @@ QTreeView::branch:open:has-children:has-siblings:hover {
color: #8cf944;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #2d3038; }
#screenshot_item:focus { background: #2d3038; }
#screenshot_item:hover { background: #2d3038; }
#screenshot_item:hover:focus { background: #2d3038; }
/* Richtext link color */
QLabel#richtext_link_color { color: #8cf944; }
+8
View File
@@ -390,5 +390,13 @@ QTreeView::branch:open:has-children:has-siblings:hover {
background-color: #4c4b4b;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #3d3d3d; }
#screenshot_item:focus { background: #4c4b4b; }
#screenshot_item:hover { background: #3d3d3d; }
#screenshot_item:hover:focus { background: #4c4b4b; }
/* Richtext link color */
QLabel#richtext_link_color { color: #87cefa; }
@@ -377,5 +377,13 @@ QTreeView::branch:open:has-children:has-siblings:hover {
background-color: #0078D7;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #354454; }
#screenshot_item:focus { background: #0078D7; }
#screenshot_item:hover { background: #354454; }
#screenshot_item:hover:focus { background: #0078D7; }
/* Richtext link color */
QLabel#richtext_link_color { color: #87cefa; }
@@ -499,5 +499,13 @@ QWidget#trophy_notification_frame {
color: #ffd785;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #615c51; }
#screenshot_item:focus { background: #4d4940; }
#screenshot_item:hover { background: #615c51; }
#screenshot_item:hover:focus { background: #4d4940; }
/* Richtext link color */
QLabel#richtext_link_color { color: #87cefa; }
+34
View File
@@ -1055,6 +1055,40 @@ QDockWidget::close-button:pressed {
background-color: transparent;
}
/* ========================================================================== */
/* Screenshot Manager */
/* ========================================================================== */
#screenshot_flow_widget #flow_widget_content {
background: transparent;
}
#screenshot_item {
background-color: transparent;
border: 1px solid transparent;
border-radius: 0px;
}
#screenshot_item:hover,
#screenshot_item[hover="true"] {
background-color: #4d5a46;
border-color: #66745d;
}
#screenshot_item[selected="true"] {
background-color: #958831;
border-top: 1px solid #889576;
border-left: 1px solid #889576;
border-right: 1px solid #30382c;
border-bottom: 1px solid #30382c;
}
#screenshot_item:focus,
#screenshot_item[focus="true"] {
background-color: #596b4c;
border: 1px solid #b7bf7a;
}
/* ========================================================================== */
/* LOG / TTY */
/* ========================================================================== */
+8
View File
@@ -716,5 +716,13 @@ QTreeView::branch:open:has-children:has-siblings:hover {
color: #2397ff;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #0f1d36; }
#screenshot_item:focus { background: #0f1d36; }
#screenshot_item:hover { background: #0f1d36; }
#screenshot_item:hover:focus { background: #0f1d36; }
/* Richtext link color */
QLabel#richtext_link_color { color: #0074e7; }
+8
View File
@@ -694,3 +694,11 @@ QLabel#debugger_frame_pc {
background-color: #4343c1;
color: #FFF;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #4343c1; }
#screenshot_item:focus { background: #4343c1; }
#screenshot_item:hover { background: #4343c1; }
#screenshot_item:hover:focus { background: #4343c1; }
@@ -6,9 +6,6 @@
*/
/* ----- GLOBAL QWIDGET ----- */
/* RESET */
@@ -978,6 +975,15 @@ QMainWindow QHeaderView::section:last {
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #292929; }
#screenshot_item:focus { background: #292929; }
#screenshot_item:hover { background: #4D4D4D; }
#screenshot_item:hover:focus { background: #292929; }
/* LOG TAB */
QTabBar#tab_bar_log::tab {
text-transform: uppercase;
@@ -1051,18 +1057,12 @@ QLabel#log_stack {
}
/* ----- SETTINGS DIALOG ----- */
QDialog#settings_dialog QTabWidget::pane {
margin-left: -8px;
}
/* ----- PAD SETTINGS DIALOG ----- */
QDialog#pad_settings_dialog QTabWidget::pane {
margin-left: -4px;
@@ -1082,9 +1082,6 @@ QGroupBox#gb_l1, QGroupBox#gb_select, QGroupBox#gb_start, QGroupBox#gb_r1, QGrou
}
/* PATCH MANAGER DIALOG */
QGroupBox#gb_patch_info QGroupBox {
background-color: #202020;
@@ -6,9 +6,6 @@
*/
/* ----- GLOBAL QWIDGET ----- */
/* RESET */
@@ -978,6 +975,15 @@ QMainWindow QHeaderView::section:last {
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #CCE8FF; }
#screenshot_item:focus { background: #CCE8FF; }
#screenshot_item:hover { background: #E5F3FF; }
#screenshot_item:hover:focus { background: #CCE8FF; }
/* LOG TAB */
QTabBar#tab_bar_log::tab {
text-transform: uppercase;
@@ -1051,18 +1057,12 @@ QLabel#log_stack {
}
/* ----- SETTINGS DIALOG ----- */
QDialog#settings_dialog QTabWidget::pane {
margin-left: -8px;
}
/* ----- PAD SETTINGS DIALOG ----- */
QDialog#pad_settings_dialog QTabWidget::pane {
margin-left: -4px;
@@ -1082,9 +1082,6 @@ QGroupBox#gb_l1, QGroupBox#gb_select, QGroupBox#gb_start, QGroupBox#gb_r1, QGrou
}
/* PATCH MANAGER DIALOG */
QGroupBox#gb_patch_info QGroupBox {
background-color: #F3F3F3;
+8
View File
@@ -476,3 +476,11 @@ QLabel#validLabel {
#game_list_grid_item[focus="true"] #game_list_grid_item_title_label {
color: #aea993;
}
/* Screenshot Manager */
#screenshot_flow_widget #flow_widget_content { background: transparent; }
#screenshot_item { background: transparent; }
#screenshot_item[selected=\"true\"] { background: #4d4940; }
#screenshot_item:focus { background: #4d4940; }
#screenshot_item:hover { background: transparent; }
#screenshot_item:hover:focus { background: #4d4940; }
+2 -21
View File
@@ -23,6 +23,7 @@ screenshot_item::screenshot_item(QWidget* parent, QSize icon_size, const QString
{
setObjectName("screenshot_item");
setFocusPolicy(Qt::StrongFocus);
setAttribute(Qt::WA_Hover); // We need to enable the hover attribute to ensure that hover events are handled.
setToolTip(icon_path);
cb_on_first_visibility = [this]()
@@ -43,16 +44,14 @@ screenshot_item::screenshot_item(QWidget* parent, QSize icon_size, const QString
m_label = new QLabel(this);
m_label->setObjectName("screenshot_item_label");
m_label->setAttribute(Qt::WA_TransparentForMouseEvents);
m_label->setScaledContents(true);
m_label->setPixmap(placeholder);
m_label->setFixedSize(m_icon_size);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(3, 3, 3, 3);
layout->setAlignment(Qt::AlignCenter);
layout->addWidget(m_label);
setFixedSize(m_icon_size + QSize(6, 6));
connect(this, &screenshot_item::signal_icon_update, this, &screenshot_item::update_icon, Qt::ConnectionType::QueuedConnection);
}
@@ -70,24 +69,6 @@ void screenshot_item::polish_style()
update();
}
void screenshot_item::paintEvent(QPaintEvent* event)
{
flow_widget_item::paintEvent(event);
if (selected || hasFocus())
{
QPainter painter(this);
painter.fillRect(rect(), palette().color(QPalette::Highlight));
}
else if (m_hover)
{
QPainter painter(this);
QColor hover_color = palette().color(QPalette::Highlight);
hover_color.setAlpha(80);
painter.fillRect(rect(), hover_color);
}
}
void screenshot_item::update_icon(const QPixmap& pixmap)
{
if (m_label)
-1
View File
@@ -27,7 +27,6 @@ private:
std::unique_ptr<QThread> m_thread;
protected:
void paintEvent(QPaintEvent* event) override;
void mouseDoubleClickEvent(QMouseEvent* ev) override;
void contextMenuEvent(QContextMenuEvent* ev) override;
void keyPressEvent(QKeyEvent* ev) override;
+1 -1
View File
@@ -25,7 +25,7 @@ screenshot_manager_dialog::screenshot_manager_dialog(const std::vector<game_info
m_icon_size = QSize(160, 90);
m_flow_widget = new flow_widget(this);
m_flow_widget->setObjectName("flow_widget");
m_flow_widget->setObjectName("screenshot_flow_widget");
m_placeholder = QPixmap(m_icon_size);
m_placeholder.fill(Qt::gray);
+8
View File
@@ -41,6 +41,14 @@ namespace gui
"#game_list_grid_item[hover=\"true\"] #game_list_grid_item_title_label { color: #fff; }"
"#game_list_grid_item[focus=\"true\"] #game_list_grid_item_title_label { color: #fff; }"
// screenshot manager
"#screenshot_flow_widget #flow_widget_content { background: transparent; }"
"#screenshot_item { background: transparent; }"
"#screenshot_item[selected=\"true\"] { background: #148aff; }"
"#screenshot_item:focus { background: #148aff; }"
"#screenshot_item:hover { background: #94c9ff; }"
"#screenshot_item:hover:focus { background: #007fff; }"
// save manager icon color
"QLabel#save_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"