-rw-r--r-- | libopie/ocolorbutton.cpp | 20 | ||||
-rw-r--r-- | libopie/ocolorbutton.h | 14 |
2 files changed, 17 insertions, 17 deletions
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index 4734c0c..ddb6c4f 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp @@ -31,30 +31,30 @@ #include <qcolor.h> #include <qpixmap.h> #include <qimage.h> - -#include <qpe/resource.h> - + +#include <qpe/resource.h> + class OColorButtonPrivate { public: QPopupMenu *m_menu; QColor m_color; }; -OColorButton::OColorButton ( QWidget *parent, const char *name ) +OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) : QPushButton ( parent, name ) { d = new OColorButtonPrivate; - - d-> m_menu = new ColorPopupMenu ( black, 0, 0 ); + + d-> m_menu = new ColorPopupMenu ( color, 0, 0 ); setPopup ( d-> m_menu ); // setPopupDelay ( 0 ); connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); - - updateColor ( black ); - + + updateColor ( color ); + QSize s = sizeHint ( ) + QSize ( 12, 0 ); setMinimumSize ( s ); - setMaximumSize ( s. width ( ) * 2, s. height ( )); + setMaximumSize ( s. width ( ) * 2, s. height ( )); } OColorButton::~OColorButton ( ) diff --git a/libopie/ocolorbutton.h b/libopie/ocolorbutton.h index ec04833..fe40fae 100644 --- a/libopie/ocolorbutton.h +++ b/libopie/ocolorbutton.h @@ -27,8 +27,8 @@ */ #ifndef __OPIE_OCOLORBUTTON_H__ -#define __OPIE_OCOLORBUTTON_H__ - +#define __OPIE_OCOLORBUTTON_H__ + #include <qpushbutton.h> class OColorButtonPrivate; @@ -37,14 +37,14 @@ class QColor; class OColorButton : public QPushButton { Q_OBJECT public: - OColorButton ( QWidget *parent = 0, const char *name = 0 ); + OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); virtual ~OColorButton ( ); - + QColor color ( ) const; - + signals: - void colorSelected ( const QColor & ); - + void colorSelected ( const QColor & ); + public slots: virtual void setColor ( const QColor & ); |