summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-06-07 08:53:18 (UTC)
committer zautrix <zautrix>2005-06-07 08:53:18 (UTC)
commitaa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4 (patch) (unidiff)
tree69bcfb2ea1e74fa38bf8c648ecba4501dfbe5690 /microkde
parentff8af7ccdd6346bba1cb871c33931352bbafe40e (diff)
downloadkdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.zip
kdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.tar.gz
kdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.tar.bz2
color dialog fix
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kcolorbutton.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 433f909..c7c6088 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,36 +1,47 @@
1#include "kcolorbutton.h" 1#include "kcolorbutton.h"
2#include "kcolordialog.h" 2#include "kcolordialog.h"
3#include "qapplication.h" 3#include "qapplication.h"
4 4
5 5
6#include "qlayout.h" 6#include "qlayout.h"
7 7#ifdef DESKTOP_VERSION
8#include <qcolordialog.h>
9#endif
8void KColorButton:: edit() 10void KColorButton:: edit()
9{ 11{
10 12
13#ifdef DESKTOP_VERSION
14 QColor col = QColorDialog::getColor ( mColor );
15 if ( col.isValid () ) {
16 mColor = col;
17 setColor ( mColor );
18 emit changed ( mColor );
19 }
20#else
11 KColorDialog* k = new KColorDialog( this ); 21 KColorDialog* k = new KColorDialog( this );
12 k->setColor( mColor ); 22 k->setColor( mColor );
13 int res = k->exec(); 23 int res = k->exec();
14 if ( res ) { 24 if ( res ) {
15 mColor = k->getColor(); 25 mColor = k->getColor();
16 setColor ( mColor ); 26 setColor ( mColor );
17 emit changed ( mColor ); 27 emit changed ( mColor );
18 } 28 }
19 delete k; 29 delete k;
30#endif
20} 31}
21KColorButton::KColorButton( QWidget *p ):QPushButton( p ) 32KColorButton::KColorButton( QWidget *p ):QPushButton( p )
22{ 33{
23 int size = 24; 34 int size = 24;
24 if( QApplication::desktop()->width() < 480 ) 35 if( QApplication::desktop()->width() < 480 )
25 size = 18; 36 size = 18;
26 setFixedSize( size,size ); 37 setFixedSize( size,size );
27 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); 38 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() ));
28 39
29} 40}
30void KColorButton::setColor ( const QColor & c) 41void KColorButton::setColor ( const QColor & c)
31{ 42{
32 mColor = c; 43 mColor = c;
33 QPixmap pix ( height() - 4, width() - 4 ); 44 QPixmap pix ( height() - 4, width() - 4 );
34 pix.fill( c ); 45 pix.fill( c );
35 setPixmap ( pix ); 46 setPixmap ( pix );
36} 47}