[SOLVED] How can i set the background color of listwidget item using rgb values?
-
I want to set the background of my listwidget item.
I don't want a simple blue so i don't want this one:@ item->setBackgroundColor("blue");@
What i want is the rgb color: 170,170,255.
How can i set the color to this rgb? -
You can use a QColor value.
E.g. through "http://doc.qt.nokia.com/4.7/qcolor.html#setRgb":http://doc.qt.nokia.com/4.7/qcolor.html#setRgb -
i had read this thread..
@ item->setBackgroundColor(QColor::setRgb ( 170, 170, 255 ));@won't work.
error: cannot call member function ‘void QColor::setRgb(int, int, int, int)’ without object -
Of course you can not. setRgb is not a static method, after all. Use fromRgb if you do not want to use a QColor object instance that you can manipulate.
This is really basic stuff, and very easy to find in the documentation file that you were already refered to. Please do a bit of digging yourself before asking. -
Haven't seen this function Andre. All fine now.
Thanks )