QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsproxystyle.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsproxystyle.cpp
3  -----------------
4  Date : March 2018
5  Copyright : (C) 2018 by Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsproxystyle.h"
17 #include <QStyleFactory>
18 #include <QStyle>
19 #include <QApplication>
20 
21 QgsProxyStyle::QgsProxyStyle( QWidget *parent )
22  : QProxyStyle( nullptr ) // no base style yet - it transfer ownership, so we need a NEW QStyle object for the base style
23 {
24  // get application style
25  QString appStyle = QApplication::style()->objectName();
26  if ( !appStyle.isEmpty() )
27  {
28  if ( QStyle *style = QStyleFactory::create( appStyle ) )
29  setBaseStyle( style );
30  }
31 
32  // set lifetime to match parent widget's
33  setParent( parent );
34 }
QgsProxyStyle(QWidget *parent)
Constructor for QgsProxyStyle.