mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Qt: use initial style as default style
This commit is contained in:
parent
40604f6076
commit
bc9f0fe56c
@ -747,14 +747,31 @@ void gui_application::OnChangeStyleSheetRequest()
|
||||
|
||||
const QString stylesheet_name = m_gui_settings->GetValue(gui::m_currentStylesheet).toString();
|
||||
|
||||
// Reset style to default before doing anything else, or we will get unexpected effects in custom stylesheets.
|
||||
if (const QStringList styles = QStyleFactory::keys(); !styles.empty())
|
||||
// Determine default style
|
||||
if (m_default_style.isEmpty())
|
||||
{
|
||||
// The first style is the default style according to the Qt docs.
|
||||
if (QStyle* style = QStyleFactory::create(styles.front()))
|
||||
// Use the initial style as default style
|
||||
if (const QStyle* style = QApplication::style())
|
||||
{
|
||||
setStyle(style);
|
||||
m_default_style = style->name();
|
||||
gui_log.notice("Determined '%s' as default style", m_default_style);
|
||||
}
|
||||
|
||||
// Fallback to the first style, which is supposed to be the default style according to the Qt docs.
|
||||
if (m_default_style.isEmpty())
|
||||
{
|
||||
if (const QStringList styles = QStyleFactory::keys(); !styles.empty())
|
||||
{
|
||||
m_default_style = styles.front();
|
||||
gui_log.notice("Determined '%s' as default style (first style available)", m_default_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reset style to default before doing anything else, or we will get unexpected effects in custom stylesheets.
|
||||
if (QStyle* style = QStyleFactory::create(m_default_style))
|
||||
{
|
||||
setStyle(style);
|
||||
}
|
||||
|
||||
const auto match_native_style = [&stylesheet_name]() -> QString
|
||||
|
@ -94,6 +94,8 @@ private:
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
std::shared_ptr<persistent_settings> m_persistent_settings;
|
||||
|
||||
QString m_default_style;
|
||||
|
||||
bool m_show_gui = true;
|
||||
bool m_use_cli_style = false;
|
||||
bool m_with_cli_boot = false;
|
||||
|
Loading…
Reference in New Issue
Block a user