Why don't you just use QColorDialog?
Why don't you just use QColorDialog?
Create your own custom QAbstractItemDelegate and QAbstractItem if you want to do complex drawing on the combo items.
Otherwise just use QComboBox::insertItem and pass an empty string as the first parameter and for the second a QVariant( pix ), where pix should be your pixmap filled with the color you want. Passing an empty string should provide the result you mentioned.
Marcel
How about something like this?
Qt Code:
comboBox->addItem("red"); comboBox->setItemData(0, Qt::red, Qt::BackgroundRole); comboBox->addItem("green"); comboBox->setItemData(1, Qt::green, Qt::BackgroundRole); comboBox->addItem("blue"); comboBox->setItemData(2, Qt::blue, Qt::BackgroundRole);To copy to clipboard, switch view to plain text mode
J-P Nurmi
or on the fly icon ... and all name color from QT...
Qt Code:
{ comboBox->addItem(tr("Select a filter..")); comboBox->addItem(pix,tr("GreyScale")); comboBox->addItem(tr("RGB Swapped")); comboBox->addItem(tr("InvertPixels color")); } }To copy to clipboard, switch view to plain text mode
wow, thanks a lot.
I'll post back if I hve any more problems
I am having one small problem now:
In the comboBox, when you scroll over the color it changes color because it mixes blue (the highlighter) of the mouse with the color and changes the appearance of the color.
Is there an easy way to disable that highlighter? or changing it somehow?
Thanks for the help!
chance palette to white or make a border on color....
code from http://qt-webdav.svn.sourceforge.net...v/html_editor/
html editor && image editor from subdir http://sourceforge.net/projects/qt-webdav/
of topic... is chguy2 indended from switzerland?
I have a widget that is a combobox that allows to pick colours from a user defined set of options. It'll be published as part of a larger widget set after Easter. So keep your eyes open if you're interested.
I changed the palette to white, but now when I scroll down the colors go from red, blue, green to white when they are highlighted. I also can't find that: Filter apply. I guess its too good to be true. I am using Qt 4.2.2.
What I am trying to do is just make this one comboBox highlight disabled or set to transparent.
And sorry Patrik, I am from Canada.
Last edited by chguy2; 5th April 2007 at 14:35.
Bookmarks