1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

Fix crash when application style is externally changed

Closes #1707
This commit is contained in:
David Rosca 2015-10-14 17:01:47 +02:00
parent 0fade63d86
commit ccabc336c0
3 changed files with 3 additions and 23 deletions

View File

@ -93,7 +93,6 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_desktopNotifications(0) , m_desktopNotifications(0)
, m_webProfile(0) , m_webProfile(0)
, m_autoSaver(0) , m_autoSaver(0)
, m_proxyStyle(0)
, m_lastActiveWindow(0) , m_lastActiveWindow(0)
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2) #if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
, m_registerQAppAssociation(0) , m_registerQAppAssociation(0)
@ -463,24 +462,10 @@ void MainApplication::reloadSettings()
emit settingsReloaded(); emit settingsReloaded();
} }
ProxyStyle* MainApplication::proxyStyle() const
{
return m_proxyStyle;
}
void MainApplication::setProxyStyle(ProxyStyle* style)
{
m_proxyStyle = style;
QApplication::setStyle(style);
}
QString MainApplication::styleName() const QString MainApplication::styleName() const
{ {
if (m_proxyStyle && m_proxyStyle->baseStyle()) QProxyStyle *proxyStyle = qobject_cast<QProxyStyle*>(style());
return m_proxyStyle->baseStyle()->objectName(); return proxyStyle ? proxyStyle->baseStyle()->objectName() : style()->objectName();
return style()->objectName();
} }
QString MainApplication::currentLanguageFile() const QString MainApplication::currentLanguageFile() const

View File

@ -37,7 +37,6 @@ class MainMenu;
class Bookmarks; class Bookmarks;
class CookieJar; class CookieJar;
class AutoSaver; class AutoSaver;
class ProxyStyle;
class PluginProxy; class PluginProxy;
class BrowserWindow; class BrowserWindow;
class NetworkManager; class NetworkManager;
@ -82,9 +81,6 @@ public:
void destroyRestoreManager(); void destroyRestoreManager();
void reloadSettings(); void reloadSettings();
ProxyStyle* proxyStyle() const;
void setProxyStyle(ProxyStyle* style);
// Name of current Qt style // Name of current Qt style
QString styleName() const; QString styleName() const;
@ -175,7 +171,6 @@ private:
QWebEngineProfile* m_webProfile; QWebEngineProfile* m_webProfile;
AutoSaver* m_autoSaver; AutoSaver* m_autoSaver;
ProxyStyle* m_proxyStyle;
QList<BrowserWindow*> m_windows; QList<BrowserWindow*> m_windows;
BrowserWindow* m_lastActiveWindow; BrowserWindow* m_lastActiveWindow;

View File

@ -163,7 +163,7 @@ int main(int argc, char* argv[])
if (app.isClosing()) if (app.isClosing())
return 0; return 0;
app.setProxyStyle(new ProxyStyle); app.setStyle(new ProxyStyle);
return app.exec(); return app.exec();
} }