summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kcolorbutton.cpp7
-rw-r--r--microkde/kcolorbutton.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 96dc256..197bea2 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,47 +1,54 @@
#include "kcolorbutton.h"
#include "kcolordialog.h"
#include "qapplication.h"
#include "qlayout.h"
#ifdef DESKTOP_VERSION
#include <qcolordialog.h>
#endif
void KColorButton:: edit()
{
#ifdef DESKTOP_VERSION
QColor col = QColorDialog::getColor ( mColor );
if ( col.isValid () ) {
mColor = col;
setColor ( mColor );
emit changed ( mColor );
+ emit changedID ( mColor, id );
}
#else
KColorDialog* k = new KColorDialog( this );
k->setColor( mColor );
int res = k->exec();
if ( res ) {
mColor = k->getColor();
setColor ( mColor );
emit changed ( mColor );
+ emit changedID ( mColor, id );
}
delete k;
#endif
}
KColorButton::KColorButton( QWidget *p ):QPushButton( p )
{
int size = 24;
if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 )
size = 18;
setFixedSize( size,size );
+ int id = 0;
connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() ));
}
+void KColorButton::setID ( int i)
+{
+ id = i;
+}
void KColorButton::setColor ( const QColor & c)
{
mColor = c;
QPixmap pix ( height() - 4, width() - 4 );
pix.fill( c );
setPixmap ( pix );
}
diff --git a/microkde/kcolorbutton.h b/microkde/kcolorbutton.h
index 88b3774..983771b 100644
--- a/microkde/kcolorbutton.h
+++ b/microkde/kcolorbutton.h
@@ -1,26 +1,29 @@
#ifndef MICROKDE_KCOLORBUTTON_H
#define MICROKDE_KCOLORBUTTON_H
#include <qpushbutton.h>
#include <qcolor.h>
#include <kglobal.h>
#include <qpixmap.h>
#include <qlabel.h>
class KColorButton : public QPushButton
{
Q_OBJECT
public:
KColorButton( QWidget *p );
void setColor ( const QColor &);
+ void setID ( int i) ;
QColor color() const { return mColor ; }
signals:
void changed(const QColor &);
+ void changedID(const QColor &, int id);
private slots:
void edit();
private:
QColor mColor;
+ int id;
};
#endif