author | zautrix <zautrix> | 2005-06-12 22:36:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-12 22:36:41 (UTC) |
commit | 5e4f16e92a96bdf89f82be3b231d18ae9e257486 (patch) (unidiff) | |
tree | 6bf55a0ae92e95dc598a813ed7b7eef5c00dfb4f /microkde | |
parent | 8cfca2b9b7ece646229a72843cf8d6d63e7b8af9 (diff) | |
download | kdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.zip kdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.tar.gz kdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.tar.bz2 |
fixxxx
-rw-r--r-- | microkde/kcolorbutton.cpp | 7 | ||||
-rw-r--r-- | microkde/kcolorbutton.h | 3 |
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 | |||
@@ -7,41 +7,48 @@ | |||
7 | #ifdef DESKTOP_VERSION | 7 | #ifdef DESKTOP_VERSION |
8 | #include <qcolordialog.h> | 8 | #include <qcolordialog.h> |
9 | #endif | 9 | #endif |
10 | void KColorButton:: edit() | 10 | void KColorButton:: edit() |
11 | { | 11 | { |
12 | 12 | ||
13 | #ifdef DESKTOP_VERSION | 13 | #ifdef DESKTOP_VERSION |
14 | QColor col = QColorDialog::getColor ( mColor ); | 14 | QColor col = QColorDialog::getColor ( mColor ); |
15 | if ( col.isValid () ) { | 15 | if ( col.isValid () ) { |
16 | mColor = col; | 16 | mColor = col; |
17 | setColor ( mColor ); | 17 | setColor ( mColor ); |
18 | emit changed ( mColor ); | 18 | emit changed ( mColor ); |
19 | emit changedID ( mColor, id ); | ||
19 | } | 20 | } |
20 | #else | 21 | #else |
21 | KColorDialog* k = new KColorDialog( this ); | 22 | KColorDialog* k = new KColorDialog( this ); |
22 | k->setColor( mColor ); | 23 | k->setColor( mColor ); |
23 | int res = k->exec(); | 24 | int res = k->exec(); |
24 | if ( res ) { | 25 | if ( res ) { |
25 | mColor = k->getColor(); | 26 | mColor = k->getColor(); |
26 | setColor ( mColor ); | 27 | setColor ( mColor ); |
27 | emit changed ( mColor ); | 28 | emit changed ( mColor ); |
29 | emit changedID ( mColor, id ); | ||
28 | } | 30 | } |
29 | delete k; | 31 | delete k; |
30 | #endif | 32 | #endif |
31 | } | 33 | } |
32 | KColorButton::KColorButton( QWidget *p ):QPushButton( p ) | 34 | KColorButton::KColorButton( QWidget *p ):QPushButton( p ) |
33 | { | 35 | { |
34 | int size = 24; | 36 | int size = 24; |
35 | if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 ) | 37 | if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 ) |
36 | size = 18; | 38 | size = 18; |
37 | setFixedSize( size,size ); | 39 | setFixedSize( size,size ); |
40 | int id = 0; | ||
38 | connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); | 41 | connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); |
39 | 42 | ||
40 | } | 43 | } |
44 | void KColorButton::setID ( int i) | ||
45 | { | ||
46 | id = i; | ||
47 | } | ||
41 | void KColorButton::setColor ( const QColor & c) | 48 | void KColorButton::setColor ( const QColor & c) |
42 | { | 49 | { |
43 | mColor = c; | 50 | mColor = c; |
44 | QPixmap pix ( height() - 4, width() - 4 ); | 51 | QPixmap pix ( height() - 4, width() - 4 ); |
45 | pix.fill( c ); | 52 | pix.fill( c ); |
46 | setPixmap ( pix ); | 53 | setPixmap ( pix ); |
47 | } | 54 | } |
diff --git a/microkde/kcolorbutton.h b/microkde/kcolorbutton.h index 88b3774..983771b 100644 --- a/microkde/kcolorbutton.h +++ b/microkde/kcolorbutton.h | |||
@@ -5,22 +5,25 @@ | |||
5 | #include <qcolor.h> | 5 | #include <qcolor.h> |
6 | #include <kglobal.h> | 6 | #include <kglobal.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | 9 | ||
10 | 10 | ||
11 | class KColorButton : public QPushButton | 11 | class KColorButton : public QPushButton |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | KColorButton( QWidget *p ); | 15 | KColorButton( QWidget *p ); |
16 | void setColor ( const QColor &); | 16 | void setColor ( const QColor &); |
17 | void setID ( int i) ; | ||
17 | QColor color() const { return mColor ; } | 18 | QColor color() const { return mColor ; } |
18 | signals: | 19 | signals: |
19 | void changed(const QColor &); | 20 | void changed(const QColor &); |
21 | void changedID(const QColor &, int id); | ||
20 | private slots: | 22 | private slots: |
21 | void edit(); | 23 | void edit(); |
22 | private: | 24 | private: |
23 | QColor mColor; | 25 | QColor mColor; |
26 | int id; | ||
24 | }; | 27 | }; |
25 | 28 | ||
26 | #endif | 29 | #endif |