Skip to content
Permalink
Browse files

Fix parsing of #rrggbbaa colors under Qt5

  • Loading branch information
nyalldawson committed Mar 18, 2016
1 parent 81d4d08 commit da635d4069f5cc4963113cbd87f101d6633eba39
Showing with 6 additions and 5 deletions.
  1. +0 −1 ci/travis/linux/qt5/blacklist.txt
  2. +6 −4 src/core/symbology-ng/qgssymbollayerv2utils.cpp
@@ -16,7 +16,6 @@ qgis_painteffecttest
qgis_pointpatternfillsymboltest
qgis_simplemarkertest
qgis_svgmarkertest
qgis_symbolv2test
qgis_fieldexpressionwidget
qgis_alignrastertest
PyQgsAnalysis
@@ -3243,8 +3243,11 @@ QColor QgsSymbolLayerV2Utils::parseColorWithAlpha( const QString& colorStr, bool
{
QColor parsedColor;

//color in hex format "#aabbcc"
if ( QColor::isValidColor( colorStr ) )
QRegExp hexColorAlphaRx( "^\\s*#?([0-9a-fA-F]{6})([0-9a-fA-F]{2})\\s*$" );
int hexColorIndex = hexColorAlphaRx.indexIn( colorStr );

//color in hex format "#aabbcc", but not #aabbccdd
if ( hexColorIndex == -1 && QColor::isValidColor( colorStr ) )
{
//string is a valid hex color string
parsedColor.setNamedColor( colorStr );
@@ -3256,8 +3259,7 @@ QColor QgsSymbolLayerV2Utils::parseColorWithAlpha( const QString& colorStr, bool
}

//color in hex format, with alpha
QRegExp hexColorAlphaRx( "^\\s*#?([0-9a-fA-F]{6})([0-9a-fA-F]{2})\\s*$" );
if ( hexColorAlphaRx.indexIn( colorStr ) != -1 )
if ( hexColorIndex > -1 )
{
QString hexColor = hexColorAlphaRx.cap( 1 );
parsedColor.setNamedColor( QString( "#" ) + hexColor );

0 comments on commit da635d4

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