00001 00019 #include <QPainter> 00020 00021 #include "KoColorPatch.h" 00022 00023 KoColorPatch::KoColorPatch( QWidget *parent ) : QFrame( parent ) 00024 { 00025 setFrameStyle( QFrame::Panel | QFrame::Sunken ); 00026 } 00027 00028 KoColorPatch::~KoColorPatch() 00029 { 00030 } 00031 00032 void KoColorPatch::setColor(const KoColor c) 00033 { 00034 m_color = c; 00035 00036 update(); 00037 } 00038 00039 void KoColorPatch::paintEvent ( QPaintEvent* pe ) 00040 { 00041 QColor qc; 00042 m_color.toQColor(&qc); 00043 00044 QFrame::paintEvent(pe); 00045 QPainter painter( this ); 00046 painter.setPen(qc); 00047 painter.setBrush(QBrush(qc)); 00048 painter.drawRect(contentsRect()); 00049 } 00050 00051 #include "KoColorPatch.moc"