pcsx2
pcsx2 copied to clipboard
Qt: Add Custom background support
Description of Changes
This PR adds the ability to set custom background on the game list.
Preview:
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
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)
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.
Works quiet well! (Arch linux based distro)
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 ofGameListWidget::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).
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 ofGameListWidget::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?
I'm not sure how to reach the
QStackWidgetitself. I did use thesetPalleteon them_ui.stackbut 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).
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
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.
What if you decode the frames manually then update the background every few ms from a worker thread? 🤔
Animated WEBP and GIF now works!
https://github.com/user-attachments/assets/e9bda970-262a-489b-8a30-c6c81f26d746
Animated WEBP and GIF now works!
2025-06-08.14-51-36.mp4
NO WAY :0, I will test that later this day!
It works! Opacity also works and the "clear background" button works as well. (testing on linux)
macOS works.
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):
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.
- The selections are fully opaque for readability sake.
- And no its set to keep the aspect ratio (we can expand it in the future with Stretch to Fill)
APNG support has been added courtesy of @TheLastRar !
also has been re-tested on Linux and macOS:
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.
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.
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).
Latest update, the entire custom background settings have been moved to Settings -> Interface. also added an option to fill the custom image to the available background space.
https://github.com/user-attachments/assets/4aea51f7-6f82-4085-8507-5cb704febd60
With these new changes, can I have testers retest?
Also macOS just in case works good there too
Supported Image Types (*.bmp *.gif *.jpg *.jpeg *.png *.webp) is untranslatable