summaryrefslogtreecommitdiff
path: root/libqtaux/ocolorbutton.cpp
Unidiff
Diffstat (limited to 'libqtaux/ocolorbutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/ocolorbutton.cpp12
1 files changed, 10 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
@@ -58,17 +58,17 @@ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *n
58 58
59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
60 setPopup ( d-> m_menu ); 60 setPopup ( d-> m_menu );
61 //setPopupDelay ( 0 ); 61 //setPopupDelay ( 0 );
62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&))); 62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
63 63
64 updateColor ( color );
65 64
66 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 65 QSize s = sizeHint ( ) + QSize ( 12, 0 );
67 setMinimumSize ( s ); 66 setMinimumSize ( s );
68 setMaximumSize ( s. width ( ) * 2, s. height ( )); 67 setMaximumSize ( s. width ( ) * 2, s. height ( ));
68 d->m_color = color;
69} 69}
70 70
71/** 71/**
72 * This destructs the object 72 * This destructs the object
73 */ 73 */
74OColorButton::~OColorButton ( ) 74OColorButton::~OColorButton ( )
@@ -97,13 +97,13 @@ void OColorButton::setColor ( const QColor &c )
97 * @internal 97 * @internal
98 */ 98 */
99void OColorButton::updateColor ( const QColor &c ) 99void OColorButton::updateColor ( const QColor &c )
100{ 100{
101 d-> m_color = c; 101 d-> m_color = c;
102 102
103 QImage img ( 16, 16, 32 ); 103 QImage img ( width()-14, height()-6, 32 );
104 img. fill ( 0 ); 104 img. fill ( 0 );
105 105
106 int r, g, b; 106 int r, g, b;
107 c. rgb ( &r, &g, &b ); 107 c. rgb ( &r, &g, &b );
108 108
109 int w = img. width ( ); 109 int w = img. width ( );
@@ -142,6 +142,14 @@ void OColorButton::updateColor ( const QColor &c )
142 pix. convertFromImage ( img ); 142 pix. convertFromImage ( img );
143 setPixmap ( pix ); 143 setPixmap ( pix );
144 144
145 emit colorSelected ( c ); 145 emit colorSelected ( c );
146} 146}
147 147
148
149/**
150 * @internal
151 */
152void OColorButton::resizeEvent( QResizeEvent *ev ) {
153 QPushButton::resizeEvent( ev );
154 updateColor(d->m_color);
155}