Skip to content

Commit

Permalink
[themes] Allow customization of palette role colors
Browse files Browse the repository at this point in the history
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 4, 2019
1 parent 76941de commit 1ca3f4b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit 1ca3f4b

Please sign in to comment.