Skip to content

Commit e1e3f86

Browse files
committed
Fix color picker does not show previous color
1 parent f63a69b commit e1e3f86

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/gui/qgscolorbutton.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ void QgsColorButton::showColorDialog()
9797
QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this );
9898
if ( panel && panel->dockMode() )
9999
{
100-
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, color(), QgsCompoundColorWidget::LayoutVertical );
100+
QColor currentColor = color();
101+
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, currentColor, QgsCompoundColorWidget::LayoutVertical );
101102
colorWidget->setPanelTitle( mColorDialogTitle );
102103
colorWidget->setAllowAlpha( mAllowAlpha );
104+
105+
if ( currentColor.isValid() )
106+
{
107+
colorWidget->setPreviousColor( currentColor );
108+
}
109+
103110
connect( colorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( setValidTemporaryColor( QColor ) ) );
104111
panel->openPanel( colorWidget );
105112
return;

0 commit comments

Comments
 (0)