PDA

View Full Version : Is QMousePress in an area?



nearlyNERD
30th March 2010, 11:50
Hey,

I've a problem:

I want to specificy a area, like a ellipse and I want to check, wether the mousepress(event) is in this area.

For Example:

Ellipse: 20, 20, 10, 10 and now I want to check, if the mousepositions are in this ellipse.

Thanks in advance.


nearlyNERD

toutarrive
30th March 2010, 12:46
Have a look at http://doc.trolltech.com/4.6/qrect.html#contains

spud
30th March 2010, 14:23
QRect rect(10,10,100,100);
QPoint p(11,11);
if(rect.contains(p))
{
qDebug()<<"Inside bounding box";
if (QRegion(rect, QRegion::Ellipse).contains(p))
qDebug()<<"Inside ellipse";
}