Qt-interest Archive, August 2007
Color Selector
Message 1 in thread
Hello,
Does QT provide any component for quick color selection ?
I know there is a QColorDialog, but I am looking for something like a
combo box
where each item has a background color from which color could be
selected.
Is there a built in component for this ?
I am trying to build that component in the following way but with no
success
Basically I need to give a background color to every combobox items.
ColorComboBox::ColorComboBox(QWidget *parent) : QComboBox(parent)
{
addItem("item 1");
addItem("item 2");
setItemData(0, QVarient(QColor(0,0,0)), Qt::BackgroundColorRole);
}
What am I doing wrong here ?
Thnx in advance!
Prateek
Message 2 in thread
This works. There was some problem with my build env. and was picking up
the pervious exe...
________________________________
From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
Sent: Wednesday, August 08, 2007 11:31 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: Color Selector
Hello,
Does QT provide any component for quick color selection ?
I know there is a QColorDialog, but I am looking for something
like a combo box
where each item has a background color from which color could be
selected.
Is there a built in component for this ?
I am trying to build that component in the following way but
with no success
Basically I need to give a background color to every combobox
items.
ColorComboBox::ColorComboBox(QWidget *parent) :
QComboBox(parent)
{
addItem("item 1");
addItem("item 2");
setItemData(0, QVarient(QColor(0,0,0)),
Qt::BackgroundColorRole);
}
What am I doing wrong here ?
Thnx in advance!
Prateek