@@ -24,8 +24,12 @@ QgsProxyStyle::QgsProxyStyle( QWidget *parent )
24
24
: QProxyStyle( nullptr ) // no base style yet - it transfers ownership, so we need a NEW QStyle object for the base style
25
25
{
26
26
// get application style
27
- QString appStyle = QApplication::style ()->objectName ();
28
- if ( !appStyle.isEmpty () )
27
+ const QString appStyle = QApplication::style ()->objectName ();
28
+ if ( appStyle == QLatin1String ( " QgsAppStyle" ) )
29
+ {
30
+ setBaseStyle ( static_cast < QgsAppStyle * >( QApplication::style () )->clone () );
31
+ }
32
+ else if ( !appStyle.isEmpty () )
29
33
{
30
34
if ( QStyle *style = QStyleFactory::create ( appStyle ) )
31
35
setBaseStyle ( style );
@@ -43,12 +47,15 @@ QgsProxyStyle::QgsProxyStyle( QWidget *parent )
43
47
44
48
QgsAppStyle::QgsAppStyle ( const QString &base )
45
49
: QProxyStyle( nullptr ) // no base style yet - it transfers ownership, so we need a NEW QStyle object for the base style
50
+ , mBaseStyle( base )
46
51
{
47
- if ( !base .isEmpty () )
52
+ if ( !mBaseStyle .isEmpty () )
48
53
{
49
- if ( QStyle *style = QStyleFactory::create ( base ) )
54
+ if ( QStyle *style = QStyleFactory::create ( mBaseStyle ) )
50
55
setBaseStyle ( style );
51
56
}
57
+
58
+ setObjectName ( QStringLiteral ( " QgsAppStyle" ) );
52
59
}
53
60
54
61
QPixmap QgsAppStyle::generatedIconPixmap ( QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt ) const
@@ -74,4 +81,9 @@ QPixmap QgsAppStyle::generatedIconPixmap( QIcon::Mode iconMode, const QPixmap &p
74
81
return QProxyStyle::generatedIconPixmap ( iconMode, pixmap, opt );
75
82
}
76
83
84
+ QProxyStyle *QgsAppStyle::clone ()
85
+ {
86
+ return new QgsAppStyle ( mBaseStyle );
87
+ }
88
+
77
89
// /@endcond
0 commit comments