summaryrefslogtreecommitdiffabout
path: root/microkde/kcolorbutton.cpp
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (side-by-side diff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kcolorbutton.cpp
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'microkde/kcolorbutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kcolorbutton.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
new file mode 100644
index 0000000..433f909
--- a/dev/null
+++ b/microkde/kcolorbutton.cpp
@@ -0,0 +1,36 @@
+#include "kcolorbutton.h"
+#include "kcolordialog.h"
+#include "qapplication.h"
+
+
+#include "qlayout.h"
+
+void KColorButton:: edit()
+{
+
+ KColorDialog* k = new KColorDialog( this );
+ k->setColor( mColor );
+ int res = k->exec();
+ if ( res ) {
+ mColor = k->getColor();
+ setColor ( mColor );
+ emit changed ( mColor );
+ }
+ delete k;
+}
+KColorButton::KColorButton( QWidget *p ):QPushButton( p )
+{
+ int size = 24;
+ if( QApplication::desktop()->width() < 480 )
+ size = 18;
+ setFixedSize( size,size );
+ connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() ));
+
+}
+void KColorButton::setColor ( const QColor & c)
+{
+ mColor = c;
+ QPixmap pix ( height() - 4, width() - 4 );
+ pix.fill( c );
+ setPixmap ( pix );
+}