I don't modify the modelI didn't say my code was better than yours, I have only shown how to make my color combobox display colors in a different way. Many ways may lead to the same result, there is no point in discussing the differences.
I don't modify the modelI didn't say my code was better than yours, I have only shown how to make my color combobox display colors in a different way. Many ways may lead to the same result, there is no point in discussing the differences.
Hi,
I tried the spirit's idea. It works fine for the menu but the selected option does not display the background color.
How can I put the color in the background of the actual index?
Thank you very much!
When the index changes I need to set the base with the color of the current index:
Qt Code:
setPalette(pal);To copy to clipboard, switch view to plain text mode
This works very well, I have the correct color in the right place... but, the highlight mess it up. I don't need the highlight since I'm working with colors.
Is there a way to simple remove the highlight?
I had tried this:
Qt Code:
To copy to clipboard, switch view to plain text mode
but it's not transparent, it's white.
I did a workaround. The idea was make the highlight with the same color of the item.
Connect the highlighted signal from QComboBox:
Qt Code:
{ connect( this, SIGNAL(highlighted(int)), this, SLOT(slotHighlight(int)) ); }To copy to clipboard, switch view to plain text mode
The slot will set the correct color for the current item:
Qt Code:
void ComboBoxColor::slotHighlight(int index) { setPalette(palette); }To copy to clipboard, switch view to plain text mode
spirit
Default Re: Color ComboBox
take a look at this example. I think it should help you.
plzzzzzzzzzzz any body sent me that code iam in deep need to it
whin i open the above link it dosnt open
Hi, see here:
http://doc.qt.io/qt-4.8/qt-itemviews...y-example.html
Ginsengelf
Bookmarks