QRgb qRgba ( int r, int g, int b, int a ),which needs int parameter,but I have the value of r,g,b is between 0 and 1? How to convert them to int value?
thank u.
QRgb qRgba ( int r, int g, int b, int a ),which needs int parameter,but I have the value of r,g,b is between 0 and 1? How to convert them to int value?
thank u.
You have to manually map the values from.
0..........1
On
0..........255
Then pass the mapped value in qRgba(); I am not good in Mathematics otherwise could have provide you the actual solution.
If you just want to create a QColor from rgb values between 0 and 1, you can also use QColor::setRgbF(). No need to think about and polluting your code with it.
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
thk u.i wil try.
Bookmarks