summaryrefslogtreecommitdiffabout
path: root/microkde/kcolorbutton.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kcolorbutton.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
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 );
}