Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to convert rgb value to QColor?
kishore_hemmady last edited by kishore_hemmady
I have r g b value ,how can i covert that into QColor object ?
so like in your other topics you really refuse to take a look at the docs at all, right?!
JonB last edited by
If you don't want to read through the docs, how about Googling for
QColor rgb? It's actually quicker than posting a question....
Here's an easy how to, in case you're using QtCreator as your IDE:
- move Courser in center of
F1, this will open the Context Help
- Scroll down to
In 90% of all cases you'll find an answer to your question.
Other IDEs/Frameworks would murder for a documentation like Qt has, so use it, it's powerfull!
Prince_0912 last edited by
Hi @kishore_hemmady ,
It is very simple,
QColor newColor = getColor.fromRgb(int r, int g, int b, int a = 255);
@Prince_0912 It's even easier
QColor color(red, green, blue);
And fromRgb() is static - you do not need a QColor instance to use it:
QColor color = QColor::fromRgb(...);