Qt: Use Window/AutoFillBackground for game list background

Fixes scrolling glitching out, as well as the background not showing in
the Qt Windows 11 theme.
pull/3559/head
Stenzek 2 months ago
parent 0136f721c4
commit ec6a411bdf
No known key found for this signature in database

@ -496,6 +496,12 @@ bool System::ProcessStartup(Error* error)
// Initialize rapidyaml before anything can use it.
SetRymlCallbacks();
#ifdef __linux__
// Running DuckStation out of /usr/lib is not supported and makes no sense.
if (std::memcmp(EmuFolders::AppRoot.data(), "/usr/""lib", 8) == 0)
return false;
#endif
return true;
}

@ -1428,6 +1428,7 @@ void GameListWidget::reloadThemeSpecificImages()
void GameListWidget::updateBackground(bool reload_image)
{
const bool had_image = !m_background_image.isNull();
if (reload_image)
{
m_background_image = QImage();
@ -1444,8 +1445,13 @@ void GameListWidget::updateBackground(bool reload_image)
if (m_background_image.isNull())
{
m_ui.stack->setPalette(palette());
m_list_view->setAlternatingRowColors(true);
if (had_image)
{
m_ui.stack->setPalette(qApp->palette(m_ui.stack));
m_ui.stack->setAutoFillBackground(false);
m_list_view->setAlternatingRowColors(true);
}
return;
}
@ -1458,8 +1464,10 @@ void GameListWidget::updateBackground(bool reload_image)
return;
QPalette new_palette(m_ui.stack->palette());
new_palette.setBrush(QPalette::Base, QPixmap::fromImage(image));
new_palette.setBrush(QPalette::Window, QPixmap::fromImage(image));
new_palette.setBrush(QPalette::Base, Qt::transparent);
m_ui.stack->setPalette(new_palette);
m_ui.stack->setAutoFillBackground(true);
m_list_view->setAlternatingRowColors(false);
};
});

@ -531,12 +531,7 @@ bool QtHost::SetCriticalFolders()
// the resources directory should exist, bail out if not
const std::string rcc_path = Path::Combine(EmuFolders::Resources, "duckstation-qt.rcc");
if (!FileSystem::FileExists(rcc_path.c_str()) || !QResource::registerResource(QString::fromStdString(rcc_path)) ||
!FileSystem::DirectoryExists(EmuFolders::Resources.c_str())
#ifdef __linux__
// Broken packages that won't stop distributing my application.
|| StringUtil::StartsWithNoCase(EmuFolders::AppRoot, "/usr""/lib")
#endif
)
!FileSystem::DirectoryExists(EmuFolders::Resources.c_str()))
{
QMessageBox::critical(nullptr, QStringLiteral("Error"),
QStringLiteral("Resources are missing, your installation is incomplete."));

Loading…
Cancel
Save