[Qt-interest] how to get color from QGraphicsRectItem which is filled with QLinearGradient

franki franki at franki.eu.org
Fri May 7 16:43:57 CEST 2010


Hey all,

I have QGraphicsScene with few objects, on of them is rectangle filled with 
gradient color: from red, to yellow, to blue. This rectangle represents 
temperature bar, whereas Pixmap with ZValue=1 shows floor plan of some 
building. I'm fetching temperature from sensors and I display it on the floor 
plan.

Challenge is: I would like to have font colors for each room set accordingly 
to what is shown in this temperature bar.
Question is: how to get color from specific point in this rectangle filled 
with gradient?

>From what I've read so far QImage has a nice 
QRgb QImage::pixel
function
but I stuck with converting this rectange which is actually QGraphicsRectItem 
into QImage... is this right way, or a dead end?

Has anyone different idea, or can provide some hints ?

greetings
Marek



More information about the Qt-interest-old mailing list