Commit 82c66ae3 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

add missing files

parent f17551a4
#include <QComboBox>
class QColor;
class QWidget;
class ColorComboBox : public QComboBox
Q_PROPERTY(QColor color READ color WRITE setColor USER true)
QColor color() const;
void setColor(QColor c);
ColorComboBox(QWidget *widget = 0);
void populateList();
public slots:
void slotHighlight(int index);
#include <QtGui>
#include "colorComboBox.h"
ColorComboBox::ColorComboBox(QWidget *widget) : QComboBox(widget)
//connect( this, SIGNAL(highlighted(int)), this, SLOT(slotHighlight(int)) );
QColor ColorComboBox::color() const
return qvariant_cast<QColor>(itemData(currentIndex(), Qt::DecorationRole));
void ColorComboBox::setColor(QColor color)
setCurrentIndex(findData(color, int(Qt::DecorationRole)));
void ColorComboBox::populateList()
//QStringList colorNames = QColor::colorNames();
QStringList colorNames;
colorNames <<
"red" <<
"green" <<
"blue" <<
"cyan "<<
"magenta" <<
"yellow" <<
"gray" <<
"white" <<
for (int i = 0; i < colorNames.size(); ++i)
QColor color(colorNames[i]);
insertItem(i, colorNames[i]);
setItemData(i, color, Qt::DecorationRole);
void ColorComboBox::slotHighlight(int index)
const QStringList colorNames = QColor::colorNames();
QColor color(;
QPalette palette = this->palette();
palette.setColor(QPalette::Highlight, color);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment