author | zecke <zecke> | 2004-09-12 16:07:13 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-12 16:07:13 (UTC) |
commit | 36a4f75e1f4e5a3858749779ea26a3fe3154d1f0 (patch) (side-by-side diff) | |
tree | 18a61aedb81a9823cbf212cc82662c66101133f7 | |
parent | 12730b959f92a9d601d81bf28ab87fb265effe55 (diff) | |
download | opie-36a4f75e1f4e5a3858749779ea26a3fe3154d1f0.zip opie-36a4f75e1f4e5a3858749779ea26a3fe3154d1f0.tar.gz opie-36a4f75e1f4e5a3858749779ea26a3fe3154d1f0.tar.bz2 |
Do not limit the Image to 16x16 but use width() and height()
+ magic numbers to make the Image fit the button
-rw-r--r-- | libqtaux/ocolorbutton.cpp | 12 | ||||
-rw-r--r-- | libqtaux/ocolorbutton.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp index 9e41d93..925df7f 100644 --- a/libqtaux/ocolorbutton.cpp +++ b/libqtaux/ocolorbutton.cpp @@ -63,3 +63,2 @@ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *n - updateColor ( color ); @@ -68,2 +67,3 @@ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *n setMaximumSize ( s. width ( ) * 2, s. height ( )); + d->m_color = color; } @@ -102,3 +102,3 @@ void OColorButton::updateColor ( const QColor &c ) - QImage img ( 16, 16, 32 ); + QImage img ( width()-14, height()-6, 32 ); img. fill ( 0 ); @@ -147 +147,9 @@ void OColorButton::updateColor ( const QColor &c ) + +/** + * @internal + */ +void OColorButton::resizeEvent( QResizeEvent *ev ) { + QPushButton::resizeEvent( ev ); + updateColor(d->m_color); +} diff --git a/libqtaux/ocolorbutton.h b/libqtaux/ocolorbutton.h index ca68f1f..10b77d5 100644 --- a/libqtaux/ocolorbutton.h +++ b/libqtaux/ocolorbutton.h @@ -56,2 +56,5 @@ public: QColor color ( ) const; + +protected: + void resizeEvent( QResizeEvent* ); |