Skip to content
Permalink
Browse files

Use QgsColorButtonV2 for editor widgets

  • Loading branch information
nyalldawson committed Oct 9, 2014
1 parent a5b5bd4 commit 174c2f3fdf2428f0b61da973cb61645977b6097f
@@ -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();

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

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

private:
QgsColorButton* mColorButton;
QgsColorButtonV2* mColorButton;
};

#endif // QGSCOLORWIDGETWRAPPER_H

3 comments on commit 174c2f3

@m-kuhn

This comment has been minimized.

Copy link
Member

@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?

@nyalldawson

This comment has been minimized.

Copy link
Contributor 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?

@3nids

This comment has been minimized.

Copy link
Member

@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.
You can’t perform that action at this time.