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 2, 2019
1 parent 2f1efd8 commit 96eb841
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit 96eb841

Please sign in to comment.