Skip to content

Commit df9ce85

Browse files
committedOct 28, 2016
Fix color picker does not show previous color
1 parent e812e43 commit df9ce85

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎src/gui/qgscolorbuttonv2.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,19 @@ const QPixmap& QgsColorButtonV2::transparentBackground()
9494

9595
void QgsColorButtonV2::showColorDialog()
9696
{
97+
QColor currentColor = color();
9798
if ( QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this ) )
9899
{
99-
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, color(), panel->dockMode() ? QgsCompoundColorWidget::LayoutVertical :
100+
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, currentColor, panel->dockMode() ? QgsCompoundColorWidget::LayoutVertical :
100101
QgsCompoundColorWidget::LayoutDefault );
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
connect( colorWidget, SIGNAL( panelAccepted( QgsPanelWidget* ) ), this, SLOT( panelAccepted( QgsPanelWidget* ) ) );
105112
panel->openPanel( colorWidget );

0 commit comments

Comments
 (0)