Skip to content

Commit

Permalink
PyQGIS: added QgsColorButton and QgsColorButtonV2
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12771 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jan 15, 2010
1 parent 3a96ec9 commit db9db4e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/gui/gui.sip
Expand Up @@ -7,6 +7,7 @@

%Import core/core.sip

%Include qgscolorbutton.sip
%Include qgslegendinterface.sip
%Include qgisinterface.sip
%Include qgscomposerview.sip
Expand Down
34 changes: 34 additions & 0 deletions python/gui/qgscolorbutton.sip
@@ -0,0 +1,34 @@


class QgsColorButton : QToolButton
{
%TypeHeaderCode
#include <qgscolorbutton.h>
%End

public:
QgsColorButton( QWidget *parent = 0 );
~QgsColorButton();

void setColor( const QColor &color );
QColor color() const;

protected:
void paintEvent( QPaintEvent *e );

};


class QgsColorButtonV2 : QPushButton
{
%TypeHeaderCode
#include <qgscolorbutton.h>
%End

public:
QgsColorButtonV2( QWidget* parent = 0 );
QgsColorButtonV2( QString text, QWidget* parent = 0 );

void setColor( const QColor &color );
QColor color() const;
};
5 changes: 5 additions & 0 deletions src/gui/qgscolorbutton.cpp
Expand Up @@ -75,6 +75,11 @@ QgsColorButtonV2::QgsColorButtonV2( QWidget* parent )
{
}

QgsColorButtonV2::QgsColorButtonV2( QString text, QWidget* parent )
: QPushButton( text, parent )
{
}

void QgsColorButtonV2::setColor( const QColor &color )
{
mColor = color;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgscolorbutton.h
Expand Up @@ -39,10 +39,11 @@ class GUI_EXPORT QgsColorButton: public QToolButton
};


class QgsColorButtonV2 : public QPushButton
class GUI_EXPORT QgsColorButtonV2 : public QPushButton
{
public:
QgsColorButtonV2( QWidget* parent = 0 );
QgsColorButtonV2( QString text, QWidget* parent = 0 );

void setColor( const QColor &color );
QColor color() const { return mColor; }
Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgssymbolv2propertiesdialog.cpp
Expand Up @@ -330,6 +330,8 @@ void QgsSymbolV2PropertiesDialog::layerTypeChanged()

// change layer to a new (with different type)
QgsSymbolLayerV2* newLayer = am->createSymbolLayer( QgsStringMap() );
if ( newLayer == NULL )
return;
mSymbol->changeSymbolLayer( currentLayerIndex(), newLayer );

updateSymbolLayerWidget( newLayer );
Expand Down

0 comments on commit db9db4e

Please sign in to comment.