knapshots
2nd June 2011, 16:40
Guys,
i tried using qlinear gradient as the opacity mask for qgraphicsopacityeffect on a qgraphicspixmap item to change the transparency of certain region of the item like this
/*******CODE STARTS
//expose is the name of the qgraphicsopacityeffect variable
//theRect defines the area where the opacity has to be changed
// setGraphicsEffect(expose); has already been done
QLinearGradient* theDude= new QLinearGradient(theRect.topLeft(),theRect.bottomRi ght();
theDude->setColorAt(0,Qt::transparent);
theDude->setColorAt(1.0,Qt::white);
expose->setOpacityMask(*theDude);
delete theDude;
*************CODE ENDS******************************/
but this code always ends up changing only the bottom right of the qgraphicspixmapitem no matter which rectangle is passed...
where am i goin wrong... and in general, how do u change transparency of part of
a qgraphicspixmapitem and leave the rest of the area unaffected;
i tried using qlinear gradient as the opacity mask for qgraphicsopacityeffect on a qgraphicspixmap item to change the transparency of certain region of the item like this
/*******CODE STARTS
//expose is the name of the qgraphicsopacityeffect variable
//theRect defines the area where the opacity has to be changed
// setGraphicsEffect(expose); has already been done
QLinearGradient* theDude= new QLinearGradient(theRect.topLeft(),theRect.bottomRi ght();
theDude->setColorAt(0,Qt::transparent);
theDude->setColorAt(1.0,Qt::white);
expose->setOpacityMask(*theDude);
delete theDude;
*************CODE ENDS******************************/
but this code always ends up changing only the bottom right of the qgraphicspixmapitem no matter which rectangle is passed...
where am i goin wrong... and in general, how do u change transparency of part of
a qgraphicspixmapitem and leave the rest of the area unaffected;