18 #include <QStyleFactory>
20 #include <QStyleOption>
21 #include <QApplication>
24 : QProxyStyle( nullptr )
27 const QString appStyle = QApplication::style()->objectName();
28 if ( appStyle == QLatin1String(
"QgsAppStyle" ) )
30 setBaseStyle(
static_cast< QgsAppStyle *
>( QApplication::style() )->clone() );
32 else if ( !appStyle.isEmpty() )
34 if ( QStyle *style = QStyleFactory::create( appStyle ) )
35 setBaseStyle( style );
48 QgsAppStyle::QgsAppStyle(
const QString &base )
49 : QProxyStyle( nullptr )
52 if ( !mBaseStyle.isEmpty() )
54 if ( QStyle *style = QStyleFactory::create( mBaseStyle ) )
55 setBaseStyle( style );
58 setObjectName( QStringLiteral(
"QgsAppStyle" ) );
61 QPixmap QgsAppStyle::generatedIconPixmap( QIcon::Mode iconMode,
const QPixmap &pixmap,
const QStyleOption *opt )
const
67 if ( !pixmap.isNull() )
71 QImage im = pixmap.toImage().convertToFormat( QImage::Format_ARGB32 );
74 return QPixmap::fromImage( im );
85 return QProxyStyle::generatedIconPixmap( iconMode, pixmap, opt );
88 QProxyStyle *QgsAppStyle::clone()
90 return new QgsAppStyle( mBaseStyle );
static void multiplyOpacity(QImage &image, double factor)
Multiplies opacity of image pixel values by a factor.
static void adjustHueSaturation(QImage &image, double saturation, const QColor &colorizeColor=QColor(), double colorizeStrength=1.0)
Alter the hue or saturation of a QImage.
QgsProxyStyle(QWidget *parent)
Constructor for QgsProxyStyle.