Show
Ignore:
Timestamp:
03/03/08 03:39:24 (9 months ago)
Author:
flynd
Message:

Changed widget/colorbutton to use KColorButton when building for kde.

Location:
trunk/qt4-gui/src/widgets
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/widgets/colorbutton.cpp

    r5892 r6081  
    2020#include "colorbutton.h" 
    2121 
     22#ifndef USE_KDE 
    2223#include <QColorDialog> 
     24#endif 
    2325 
    2426using namespace LicqQtGui; 
    2527 
    26  
    2728ColorButton::ColorButton(QWidget* parent) 
    28   : QPushButton(parent) 
     29  : COLORBUTTON_BASE(parent) 
    2930{ 
     31#ifndef USE_KDE 
    3032  setFixedSize(40, 20); 
    3133  connect(this, SIGNAL(clicked()), SLOT(selectColor())); 
    32 } 
    33  
    34 QColor ColorButton::getColor() const 
    35 { 
    36   return palette().color(backgroundRole()); 
     34#endif 
    3735} 
    3836 
    3937QString ColorButton::colorName() const 
    4038{ 
    41   return palette().color(backgroundRole()).name(); 
     39  return color().name(); 
     40} 
     41 
     42#ifndef USE_KDE 
     43QColor ColorButton::color() const 
     44{ 
     45  return palette().color(backgroundRole()); 
    4246} 
    4347 
     
    5458  pal.setColor(backgroundRole(), color); 
    5559  setPalette(pal); 
    56   emit changed(); 
     60  emit changed(color); 
    5761} 
     62#endif 
  • trunk/qt4-gui/src/widgets/colorbutton.h

    r5837 r6081  
    2121#define COLORBUTTON_H 
    2222 
     23#include "config.h" 
     24 
     25#ifdef USE_KDE 
     26#include <KDE/KColorButton> 
     27#define COLORBUTTON_BASE KColorButton 
     28#else 
    2329#include <QPushButton> 
     30#define COLORBUTTON_BASE QPushButton 
     31#endif 
    2432 
    2533namespace LicqQtGui 
    2634{ 
    27 class ColorButton : public QPushButton 
     35class ColorButton : public COLORBUTTON_BASE 
    2836{ 
    2937  Q_OBJECT 
     
    3139public: 
    3240  ColorButton(QWidget* parent = NULL); 
    33   QColor getColor() const; 
    3441  QString colorName() const; 
     42#ifndef USE_KDE 
     43  QColor color() const; 
    3544 
    3645public slots: 
     
    3948 
    4049signals: 
    41    void changed(); 
     50   void changed(const QColor& color); 
     51#endif 
    4252}; 
    4353