void UBMagnifier::mouseReleaseEvent(QMouseEvent * event) { if(m_isInteractive) { mShouldMoveWidget = false; mShouldResizeWidget = false; if (event->pos().x() >= size().width() - sClosePixmap->width() && event->pos().x() < size().width()&& event->pos().y() >= size().height() / 2 + sClosePixmap->height() * 1 && event->pos().y() < size().height() / 2 + sClosePixmap->height() * 2) { event->accept(); emit magnifierClose_Signal(); } else if (event->pos().x() >= size().width() - sIncreasePixmap->width() && event->pos().x() < size().width()&& event->pos().y() >= size().height() / 2 + sIncreasePixmap->height() * 2.5 && event->pos().y() < size().height() / 2 + sIncreasePixmap->height() * 3.5) { event->accept(); emit magnifierZoomIn_Signal(); } else if (event->pos().x() >= size().width() - sDecreasePixmap->width() && event->pos().x() < size().width()&& event->pos().y() >= size().height() / 2 + sDecreasePixmap->height() * 3.6 && event->pos().y() < size().height() / 2 + sDecreasePixmap->height() * 4.6) { event->accept(); emit magnifierZoomOut_Signal(); } else QWidget::mouseReleaseEvent(event); // don't propgate to parent, the widget is deleted in UBApplication::boardController->removeTool } else event->ignore(); }
void UBMagnifier::mouseReleaseEvent(QMouseEvent * event) { if(m_isInteractive) { mShouldMoveWidget = false; mShouldResizeWidget = false; if (sClosePixmapButtonRect.contains(event->pos())) { event->accept(); emit magnifierClose_Signal(); } else if (sIncreasePixmapButtonRect.contains(event->pos())) { event->accept(); emit magnifierZoomIn_Signal(); } else if (sDecreasePixmapButtonRect.contains(event->pos())) { event->accept(); emit magnifierZoomOut_Signal(); } else if (sChangeModePixmapButtonRect.contains(event->pos())) { event->accept(); emit magnifierDrawingModeChange_Signal(static_cast<int>(mDrawingMode+1)%modesCount); } else QWidget::mouseReleaseEvent(event); // don't propgate to parent, the widget is deleted in UBApplication::boardController->removeTool } else event->ignore(); }