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 2f1efd8 commit 96eb841146f46d7452dafa9a1184c87491b9b7f7
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/core/qgsapplication.cpp
@@ -37,6 +37,7 @@
#include "qgsrasterrendererregistry.h"
#include "qgsrendererregistry.h"
#include "qgssymbollayerregistry.h"
#include "qgssymbollayerutils.h"
#include "qgspluginlayerregistry.h"
#include "qgsmessagelog.h"
#include "qgsannotationregistry.h"
@@ -763,6 +764,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 96eb841

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