mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Qt: use initial style as default style
This commit is contained in:
parent
40604f6076
commit
bc9f0fe56c
2 changed files with 24 additions and 5 deletions
|
@ -747,14 +747,31 @@ void gui_application::OnChangeStyleSheetRequest()
|
||||||
|
|
||||||
const QString stylesheet_name = m_gui_settings->GetValue(gui::m_currentStylesheet).toString();
|
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.
|
// Determine default style
|
||||||
if (const QStringList styles = QStyleFactory::keys(); !styles.empty())
|
if (m_default_style.isEmpty())
|
||||||
{
|
{
|
||||||
// The first style is the default style according to the Qt docs.
|
// Use the initial style as default style
|
||||||
if (QStyle* style = QStyleFactory::create(styles.front()))
|
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
|
const auto match_native_style = [&stylesheet_name]() -> QString
|
||||||
|
|
|
@ -94,6 +94,8 @@ private:
|
||||||
std::shared_ptr<gui_settings> m_gui_settings;
|
std::shared_ptr<gui_settings> m_gui_settings;
|
||||||
std::shared_ptr<persistent_settings> m_persistent_settings;
|
std::shared_ptr<persistent_settings> m_persistent_settings;
|
||||||
|
|
||||||
|
QString m_default_style;
|
||||||
|
|
||||||
bool m_show_gui = true;
|
bool m_show_gui = true;
|
||||||
bool m_use_cli_style = false;
|
bool m_use_cli_style = false;
|
||||||
bool m_with_cli_boot = false;
|
bool m_with_cli_boot = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue