This is how my code goes...
@
int Nightcharts::draw(QPainter *painter)
{
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
if (this->ctype==Nightcharts::Pie)
{
pW = 0;
double pdegree = 0;
//Options
QLinearGradient gradient(cX+0.5*cW,cY,cX+0.5*cW,cY+cH*2.5);
gradient.setColorAt(1,Qt::black);
//Draw
//pdegree = (360/100)*pieces[i].pPerc;
if (shadows)
{
double sumangle = 0;
for (int i=0;i<pieces.size();i++)
{
sumangle += 3.6*pieces[i].pPerc;
}
painter->setBrush(Qt::darkGray);
painter->drawPie(cX,cY+pW+5,cW,cH,palpha*16,sumangle*16);
}
QPen pen;
pen.setWidth(2);
for (int i=0;i<pieces.size();i++)
{
gradient.setColorAt(0,pieces[i].rgbColor);
painter->setBrush(gradient);
pen.setColor(pieces[i].rgbColor);
painter->setPen(pen);
pdegree = 3.6*pieces[i].pPerc;
painter->drawPie(cX,cY,cW,cH,palpha*16,pdegree*16);
palpha += pdegree;
}
@
my idea is when user clicks on a pie, get the RGB at that particular co-ordinates(X,Y)..compare the RGB with pieces[i].rgbColor..get the pie name and hence diaplay the details in a new window..
but I need your help in writing the code to get the pixel color of a window on mouse click..
many thanks in advance...