Skip to content
Permalink
Browse files

[themes] Allow customization of palette role colors

This fixes the following issues:
- combo box drop down menu white top/bottom edges
- color button header background color
- white line at top of stacked dock area
  • Loading branch information
nirvn committed Jan 2, 2019
1 parent 76941de commit 1ca3f4b419344c157fec71bfaeb1ed4e2f80add5
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/core/qgsapplication.cpp
@@ -36,6 +36,7 @@
#include "qgsrasterrendererregistry.h"
#include "qgsrendererregistry.h"
#include "qgssymbollayerregistry.h"
#include "qgssymbollayerutils.h"
#include "qgspluginlayerregistry.h"
#include "qgsmessagelog.h"
#include "qgsannotationregistry.h"
@@ -759,6 +760,28 @@ void QgsApplication::setUITheme( const QString &themeName )
file.close();

qApp->setStyleSheet( styledata );

QFile palettefile( path + "/palette.txt" );
QFileInfo paletteInfo( palettefile );
if ( paletteInfo.exists() && palettefile.open( QIODevice::ReadOnly ) )
{
QPalette pal = qApp->palette();
QTextStream in( &palettefile );
while ( !in.atEnd() )
{
QString line = in.readLine();
QStringList parts = line.split( ':' );
if ( parts.count() == 2 )
{
int role = parts.at( 0 ).trimmed().toInt();
QColor color = QgsSymbolLayerUtils::decodeColor( parts.at( 1 ).trimmed() );
pal.setColor( static_cast< QPalette::ColorRole >( role ), color );
}
}
palettefile.close();
qApp->setPalette( pal );
}

setThemeName( themeName );
}

0 comments on commit 1ca3f4b

Please sign in to comment.
You can’t perform that action at this time.