summaryrefslogtreecommitdiffabout
path: root/microkde/kcolorbutton.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kcolorbutton.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kcolorbutton.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 197bea2..16618fc 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,54 +1,57 @@
#include "kcolorbutton.h"
#include "kcolordialog.h"
#include "qapplication.h"
+#include <QDesktopWidget>
#include "qlayout.h"
#ifdef DESKTOP_VERSION
#include <qcolordialog.h>
+//Added by qt3to4:
+#include <QPixmap>
#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 );
}