Skip to content

Commit c159c57

Browse files
committedSep 11, 2014
Retain alpha if entering colors with no explicit alpha into
QgsColorTextWidget
1 parent c3bf02b commit c159c57

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/gui/qgscolorwidgets.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,8 @@ void QgsColorTextWidget::updateText()
13771377
void QgsColorTextWidget::textChanged()
13781378
{
13791379
QString testString = mLineEdit->text();
1380-
QColor color = QgsSymbolLayerV2Utils::parseColor( testString );
1380+
bool containsAlpha;
1381+
QColor color = QgsSymbolLayerV2Utils::parseColorWithAlpha( testString, containsAlpha );
13811382
if ( !color.isValid() )
13821383
{
13831384
//bad color string
@@ -1388,6 +1389,11 @@ void QgsColorTextWidget::textChanged()
13881389
//good color string
13891390
if ( color != mCurrentColor )
13901391
{
1392+
//retain alpha if no explicit alpha set
1393+
if ( !containsAlpha )
1394+
{
1395+
color.setAlpha( mCurrentColor.alpha() );
1396+
}
13911397
//color has changed
13921398
mCurrentColor = color;
13931399
emit colorChanged( mCurrentColor );

0 commit comments

Comments
 (0)
Please sign in to comment.