Skip to content

Qt: Add Custom background support #12722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kamfretoz
Copy link
Contributor

@kamfretoz kamfretoz commented May 26, 2025

Description of Changes

This PR adds the ability to set custom background on the game list.

Preview:
Screenshot_20250526_204507
Screenshot_20250526_204651
image
Screenshot_20250526_204732

Rationale behind Changes

Nice eye-candy and more customizations

Suggested Testing Steps

To set a custom image: View -> Set Custom Background

Things to test:

  • Applying custom background
  • Removing custom background

Known issues so far:

  • The background doesn't get cleared automatically when clearing the custom background
  • Unreadable text when using bright backgrounds

Did you use AI to help find, test, or implement this issue or feature?

Nuh-uh

@lightningterror lightningterror added this to the Release 2.6 milestone May 26, 2025
@RedDevilus
Copy link
Contributor

In future we could add a customisable dark filter on top for easier reading gamelist itself in as a sort of pseudo dropshadow that movie subtitles would do.

The current form limits the usecase to less viable screenshots.

But it's good for now to add some more personality (or make people crazy with meme images)

@kamfretoz
Copy link
Contributor Author

Yeah i do hope to add some kind of brightness/opacity option (or drop shadow for texts if viable) and cropping mode in the future.

@AmandaRoseChaqueta
Copy link

AmandaRoseChaqueta commented May 26, 2025

Works quiet well! (Arch linux based distro)

Screenshot_20250526_113148
image

@chaoticgd
Copy link
Contributor

chaoticgd commented May 26, 2025

I remember I previously said this could be implemented by subclassing QStackedWidget and overriding the paint event. I think I may have been overthinking that, what you're doing is probably fine (edit: actually, the palette approach does have issues, see below).

A few things I noticed:

  • The option to clear the background image currently doesn't work for me. It looks like it's because of an incorrect if (path.empty()) check right at the start of GameListWidget::setCustomBackground.
  • The background is currently being drawn by the viewport widgets inside the QTableView and GameListGridListView widgets rather than the QStackedWidget itself (verified with GammaRay) since the palette is inherited. This means that the space for the image is ever so slightly different depending on which one is visible (hence with the table view the bottom of the image is getting cut off slightly as it's offset by the header).

@kamfretoz
Copy link
Contributor Author

A few things I noticed:

  • The option to clear the background image currently doesn't work for me. It looks like it's because of an incorrect if (path.empty()) check right at the start of GameListWidget::setCustomBackground.

Whoops you were right, that check was too aggressive. I'll fix it later.

  • The background is currently being drawn by the viewport widgets inside the QTableView and GameListGridListView widgets rather than the QStackedWidget itself (verified with GammaRay) since the palette is inherited.

I'm not sure how to reach the QStackWidget itself. I did use the setPallete on the m_ui.stack but apparently its not correct?

@chaoticgd
Copy link
Contributor

chaoticgd commented May 27, 2025

I'm not sure how to reach the QStackWidget itself. I did use the setPallete on the m_ui.stack but apparently its not correct?

I've done some testing and I can't seem to get it to work with the palette method either, I'm not sure why. I think subclassing QStackedWidget and drawing the pixmap in the paintEvent function should still work though. Just make sure to use drawTiledPixmap and pass in the invalidated region. You'll need to disable autoFillBackground on the viewports (e.g. QTableView::viewport).

@kamfretoz kamfretoz force-pushed the qt-background branch 3 times, most recently from 4827654 to ae136d7 Compare May 31, 2025 04:09
@AmandaRoseChaqueta
Copy link

AmandaRoseChaqueta commented Jun 2, 2025

I wonder if it could be possible to add support for animated webps (in a future PR). It would be quiet nice to have! Gif works too but gif is yucky

@kamfretoz
Copy link
Contributor Author

I wonder if it could be possible to add support for animated webps (in a future PR).

I don't think Qt can do that.

@KrossX
Copy link
Contributor

KrossX commented Jun 4, 2025

What if you decode the frames manually then update the background every few ms from a worker thread? 🤔

@kamfretoz kamfretoz force-pushed the qt-background branch 2 times, most recently from 169b712 to dd3311a Compare June 5, 2025 14:27
@kamfretoz
Copy link
Contributor Author

Animated WEBP and GIF now works!

2025-06-08.14-51-36.mp4

@AmandaRoseChaqueta
Copy link

Animated WEBP and GIF now works!

2025-06-08.14-51-36.mp4

NO WAY :0, I will test that later this day!

@kamfretoz kamfretoz force-pushed the qt-background branch 2 times, most recently from a6b0a8c to 9307c0b Compare June 8, 2025 14:26
@AmandaRoseChaqueta
Copy link

AmandaRoseChaqueta commented Jun 8, 2025

It works! Opacity also works and the "clear background" button works as well. (testing on linux)

Screenshot_20250608_120609
Screenshot_20250608_120551-1
Screenshot_20250608_120551

@kamfretoz kamfretoz force-pushed the qt-background branch 4 times, most recently from 77d3499 to cf39fc9 Compare June 9, 2025 11:38
Copy link
Contributor

@chaoticgd chaoticgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

Copy link
Contributor

@Mrlinkwii Mrlinkwii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested both gif and png as background , both worked well on the appimage , needs macos /flatpak testing

@kamfretoz
Copy link
Contributor Author

macOS works.

Screenshot_2025-07-13_at_19 44 11

@TheTechnician27
Copy link
Contributor

TheTechnician27 commented Jul 13, 2025

Selecting a game from the game list breaks this on Flatpak, tested with the Grey Matter theme (it also doesn't stretch to fill the window):

image

@kamfretoz
Copy link
Contributor Author

Selecting a game from the game list breaks this on Flatpak, tested with the Grey Matter theme (it also doesn't stretch to fill the window):

Its not a bug, its a feature.

  1. The selections are fully opaque for readability sake.
  2. And no its set to keep the aspect ratio (we can expand it in the future with Stretch to Fill)

@kamfretoz
Copy link
Contributor Author

APNG support has been added courtesy of @TheLastRar !

also has been re-tested on Linux and macOS:

Screenshot 2025-07-16 at 21 49 33

@ghost
Copy link

ghost commented Jul 25, 2025

Works great! But I have a few notes to refine it.

  • Move all buttons to "Interface". There's enough room there if you add a scrollbar to it. This will de-clutter the current UI.
image
  • Because pictures' resolutions can be small/big, it leaves gaps that flare up anyone's OCD - it needs more "fitting" options. Windows has stretch, fill, and fit. Yours is 'fit', leaving you with two more to add.
image

@kamfretoz
Copy link
Contributor Author

Works great! But I have a few notes to refine it.

* Move all buttons to "Interface". There's enough room there if you add a scrollbar to it. This will de-clutter the current UI.
* Because pictures' resolutions can be small/big, it leaves gaps that flare up anyone's OCD - it needs more "fitting" options. Windows has stretch, fill, and fit. Yours is 'fit', leaving you with two more to add.
  • The Interface section is already crowded enough as it is. Plus i think the "View" menu is far more fitting place for it.
  • The PR has been struggling with scope creep as it is already, i wanted to leave that feature for the future.

Copy link
Member

@F0bes F0bes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the animation doesn't stop when "Render to Separate Window" is enabled while the VM is running.

I also find that putting all of these options in the View menu with no way to configure them in our normal settings window ends up awkward.
I usually go in blind at first when testing PRs, trying to match the knowledge of a new PCSX2 user. I couldn't find the setting and had to refer to the testing steps.

@kamfretoz kamfretoz force-pushed the qt-background branch 2 times, most recently from f21f269 to 60b0ac0 Compare July 30, 2025 16:31
@kamfretoz kamfretoz requested a review from F0bes July 30, 2025 16:37
Copy link
Contributor

@lightningterror lightningterror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ui options should be put in Interface, would fit better there.
Ideally in the Preferences section.

@chaoticgd
Copy link
Contributor

The ui options should be put in Interface, would fit better there. Ideally in the Preferences section.

I'd recommend waiting for #13066 and rebasing on top of that then, just to minimize merge conflicts (otherwise you'd need to add another scroll area manually, since with the auto updater group box shown there's no space).

kamfretoz and others added 3 commits August 10, 2025 12:03
Qt: Make sure custom background aren't active when game list isn't shown

To save on CPU Power and be more efficient

Co-Authored-By: TheLastRar <[email protected]>
Needed for animated WEBPs to work on Windows.

Co-Authored-By: TheLastRar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.