Skip to content
Browse files
Use QgsColorButtonV2 for editor widgets
  • Loading branch information
nyalldawson committed Oct 9, 2014
1 parent a5b5bd4 commit 174c2f3fdf2428f0b61da973cb61645977b6097f
Showing with 7 additions and 5 deletions.
  1. +4 −2 src/gui/editorwidgets/qgscolorwidgetwrapper.cpp
  2. +3 −3 src/gui/editorwidgets/qgscolorwidgetwrapper.h
@@ -33,12 +33,14 @@ QVariant QgsColorWidgetWrapper::value()

QWidget* QgsColorWidgetWrapper::createWidget( QWidget* parent )
return new QgsColorButton( parent );
QgsColorButtonV2* button = new QgsColorButtonV2( parent );
button->setContext( QString( "editor" ) );
return button;

void QgsColorWidgetWrapper::initWidget( QWidget* editor )
mColorButton = qobject_cast<QgsColorButton*>( editor );
mColorButton = qobject_cast<QgsColorButtonV2*>( editor );

connect( mColorButton, SIGNAL( colorChanged( QColor ) ), this, SLOT( valueChanged() ) );
@@ -18,7 +18,7 @@

#include "qgseditorwidgetwrapper.h"

#include "qgscolorbutton.h"
#include "qgscolorbuttonv2.h"

@@ -37,14 +37,14 @@ class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper
QVariant value();

QWidget*createWidget( QWidget* parent );
QWidget* createWidget( QWidget* parent );
void initWidget( QWidget* editor );

public slots:
void setValue( const QVariant& value );

QgsColorButton* mColorButton;
QgsColorButtonV2* mColorButton;


3 comments on commit 174c2f3


This comment has been minimized.

Copy link

@m-kuhn m-kuhn replied Oct 11, 2014

Thanks Nyall, good to have this nice button also integrated here.

Was support for the old button completely removed? I.e. is it thinkable, that somebody was using a QgsColorButton in a custom .ui file and that will no longer be supported because initWidget always assumes a QgsColorButtonV2?


This comment has been minimized.

Copy link
Collaborator Author

@nyalldawson nyalldawson replied Oct 12, 2014

@m-kuhn Well, QgsColorButton still exists, but I don't know what would happen in that use case. Given that I'm honestly clueless how these editor widgets work, should I revert this commit for 2.6?


This comment has been minimized.

Copy link

@3nids 3nids replied Oct 13, 2014

The only problem is that old custom UI file with QgsColorButton won't work anymore. But is it a real harm?

On the same idea, I will remove the QgsColorButton V1 from the custom widgets so people stop using it.

Please sign in to comment.