Hello everyone
I've tested the following RubberBand code for an image viewer. But RubberBand rectangle starts at a point a little below the mouse cursor icon instead of at the tip point mouse cursor icon. What can be the reason for this and How can I fix this situation ?
Sincerely
Cem
void ImageMarker::mousePressEvent(QMouseEvent *event)
{
origin = event->pos();
if (!rubberBand)
{
rubberBand = new QRubberBand(QRubberBand::Rectangle, imageLabel);
}
rubberBand->setGeometry(QRect(origin, QSize()));
rubberBand->show();
}
void ImageMarker::mouseMoveEvent(QMouseEvent *event)
{
rubberBand->setGeometry(QRect(origin, event->pos()));
}
void ImageMarker::mouseReleaseEvent(QMouseEvent *event)
{
rubberBand->hide();
}
Bookmarks