Skip to content
Permalink
Browse files

Retain alpha if entering colors with no explicit alpha into

QgsColorTextWidget
  • Loading branch information
nyalldawson committed Sep 11, 2014
1 parent c3bf02b commit c159c5700095b3face105ba4d3e8fa4bf8c39cec
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/gui/qgscolorwidgets.cpp
@@ -1377,7 +1377,8 @@ void QgsColorTextWidget::updateText()
void QgsColorTextWidget::textChanged()
{
QString testString = mLineEdit->text();
QColor color = QgsSymbolLayerV2Utils::parseColor( testString );
bool containsAlpha;
QColor color = QgsSymbolLayerV2Utils::parseColorWithAlpha( testString, containsAlpha );
if ( !color.isValid() )
{
//bad color string
@@ -1388,6 +1389,11 @@ void QgsColorTextWidget::textChanged()
//good color string
if ( color != mCurrentColor )
{
//retain alpha if no explicit alpha set
if ( !containsAlpha )
{
color.setAlpha( mCurrentColor.alpha() );
}
//color has changed
mCurrentColor = color;
emit colorChanged( mCurrentColor );

0 comments on commit c159c57

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