Skip to content

Commit

Permalink
Fix color picker does not show previous color
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 28, 2016
1 parent e812e43 commit df9ce85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gui/qgscolorbuttonv2.cpp
Expand Up @@ -94,12 +94,19 @@ const QPixmap& QgsColorButtonV2::transparentBackground()

void QgsColorButtonV2::showColorDialog()
{
QColor currentColor = color();
if ( QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this ) )
{
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, color(), panel->dockMode() ? QgsCompoundColorWidget::LayoutVertical :
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, currentColor, panel->dockMode() ? QgsCompoundColorWidget::LayoutVertical :
QgsCompoundColorWidget::LayoutDefault );
colorWidget->setPanelTitle( mColorDialogTitle );
colorWidget->setAllowAlpha( mAllowAlpha );

if ( currentColor.isValid() )
{
colorWidget->setPreviousColor( currentColor );
}

connect( colorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( setValidTemporaryColor( QColor ) ) );
connect( colorWidget, SIGNAL( panelAccepted( QgsPanelWidget* ) ), this, SLOT( panelAccepted( QgsPanelWidget* ) ) );
panel->openPanel( colorWidget );
Expand Down

0 comments on commit df9ce85

Please sign in to comment.