Hi. I have a problem with window-viewport coordinates. In my code I draw a polygon:
static const int upPoints_p[4][2] = {
{ 49, -49 }, { -49, -49 },
{ -10, -10 }, { 10, -10 }
};
painter.setWindow( -50, -50, 100, 100);
painter.drawPolygon(up_p);
static const int upPoints_p[4][2] = {
{ 49, -49 }, { -49, -49 },
{ -10, -10 }, { 10, -10 }
};
QPolygon up_p(4, &upPoints_p[0][0]);
painter.setWindow( -50, -50, 100, 100);
painter.drawPolygon(up_p);
To copy to clipboard, switch view to plain text mode
and next, I would like to check mousePressEvent:
if( up_p.containsPoint(point, Qt::OddEvenFill) )
{
}
QPoint point = event->pos();
if( up_p.containsPoint(point, Qt::OddEvenFill) )
{
}
To copy to clipboard, switch view to plain text mode
but I have different coordinate. Can someone help me fix my code?
Bookmarks