COPASI API  4.16.103
Functions
CQEffectDescriptionEdit.cpp File Reference
#include <QtGui/QColorDialog>
#include <qlayout/CQEffectDescription.h>
#include <qlayout/CQEffectDescriptionEdit.h>
#include <QtGui/QPainter>
Include dependency graph for CQEffectDescriptionEdit.cpp:

Go to the source code of this file.

Functions

void setColor (QLabel *widget, const QColor &color)
 

Function Documentation

void setColor ( QLabel *  widget,
const QColor &  color 
)

Definition at line 26 of file CQEffectDescriptionEdit.cpp.

Referenced by CQEffectDescriptionEdit::initFrom(), CQEffectDescriptionEdit::slotSelectColorEnd(), and CQEffectDescriptionEdit::slotSelectColorStart().

27 {
28  QPalette palette(color);
29  palette.setColor(QPalette::Base, color);
30  palette.setColor(QPalette::Background, color);
31  palette.setColor(QPalette::Window, color);
32  palette.setColor(QPalette::Foreground, color);
33  widget->setPalette(palette);
34  QImage image(widget->rect().size(), QImage::Format_ARGB32);
35 
36 #if QT_VERSION >= 0x040800
37  image.fill(color);
38 #else
39  QPainter painter(&image);
40  painter.fillRect(widget->rect(), color);
41 #endif
42 
43  QPixmap pix = QPixmap::fromImage(image);
44  widget->setPixmap(pix);
45 }