Thanks for answer. So, I change my code:
{
painter.setWindow(-50, -50, 100, 100);
QPoint out
= painter.
transform().
inverted().
map(event
->pos
());
qDebug() << point.x() << point.y();
qDebug() << out.x() << out.y();
}
void Diagram::mousePressEvent(QMouseEvent *event)
{
QPoint point = event->pos();
QPainter painter(&pixmap);
painter.setWindow(-50, -50, 100, 100);
QPoint out = painter.transform().inverted().map(event->pos());
qDebug() << point.x() << point.y();
qDebug() << out.x() << out.y();
}
To copy to clipboard, switch view to plain text mode
but I still get the same value, for example:
188 158
188 158
188 158
188 158
To copy to clipboard, switch view to plain text mode
and I can't check this condition
up_p.containsPoint(out, Qt::OddEvenFill)
up_p.containsPoint(out, Qt::OddEvenFill)
To copy to clipboard, switch view to plain text mode
because I have polygons defiened like:
static const int upPoints_p[4][2] = {
{ 49, -49 }, { -49, -49 },
{ -10, -10 }, { 10, -10 }
};
static const int upPoints_p[4][2] = {
{ 49, -49 }, { -49, -49 },
{ -10, -10 }, { 10, -10 }
};
To copy to clipboard, switch view to plain text mode
So, what am I doing wrong?
Bookmarks