...
else if (QEvent::FocusOut == event
->type
()) { // Apply and end up panning
if (qwtpltpnMain_->isVisible()) {
Qt::MouseButton pannerButton;
Qt::KeyboardModifiers pannerModifiers;
qwtpltpnMain_->getMouseButton(pannerButton, pannerModifiers);
// Force QwtPlotPanner ends up via sending the proper event. This event after
// processing by QwtPlotPanner appears here, due to QwtPlotPanner propagates it
// further, but that event does not trigger any action (e.g. cursor moving) due to
// pannerModifiers in the event.
qwtpltMain_
->canvas
()->mapFromGlobal
(QCursor::pos()), pannerButton,
pannerButton, pannerModifiers);
//##note: Aborting panning might be done with this event:
//QKeyEvent endPanning(QEvent::KeyPress, pannerKey, pannerModifiers);
//QCoreApplication::sendEvent(qwtpltMain_->canvas(), &endPanning);
}
// Cancel zooming
if (qwtpltzmMain_->isActive()) {
// Force QwtPlotZoomer cancels via sending the proper event. This event after
// processing by QwtPlotZoomer appears here, due to QwtPlotZoomer propagates it
// further.
//##assume: Qt::Key_Escape is QwtEventPattern::KeyAbort.
//##note: Applying zooming and ending might be done with this event:
//##assume: Qt::LeftButton is QwtEventPattern::MouseSelect1.
//QMouseEvent endZooming(QEvent::MouseButtonRelease,
// qwtpltMain_->canvas()->mapFromGlobal(QCursor::pos()), Qt::LeftButton,
// Qt::LeftButton, Qt::NoModifier);
// Q_ASSERT(qwtpltzmMain_->mouseMatch(QwtEventPattern::MouseSelect1, &endZooming));
}
...
...
else if (QEvent::FocusOut == event->type()) {
// Apply and end up panning
if (qwtpltpnMain_->isVisible()) {
Qt::MouseButton pannerButton;
Qt::KeyboardModifiers pannerModifiers;
qwtpltpnMain_->getMouseButton(pannerButton, pannerModifiers);
// Force QwtPlotPanner ends up via sending the proper event. This event after
// processing by QwtPlotPanner appears here, due to QwtPlotPanner propagates it
// further, but that event does not trigger any action (e.g. cursor moving) due to
// pannerModifiers in the event.
QMouseEvent endPanning(QEvent::MouseButtonRelease,
qwtpltMain_->canvas()->mapFromGlobal(QCursor::pos()), pannerButton,
pannerButton, pannerModifiers);
QCoreApplication::sendEvent(qwtpltMain_->canvas(), &endPanning);
//##note: Aborting panning might be done with this event:
//QKeyEvent endPanning(QEvent::KeyPress, pannerKey, pannerModifiers);
//QCoreApplication::sendEvent(qwtpltMain_->canvas(), &endPanning);
}
// Cancel zooming
if (qwtpltzmMain_->isActive()) {
// Force QwtPlotZoomer cancels via sending the proper event. This event after
// processing by QwtPlotZoomer appears here, due to QwtPlotZoomer propagates it
// further.
//##assume: Qt::Key_Escape is QwtEventPattern::KeyAbort.
QKeyEvent endZooming(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier);
Q_ASSERT(qwtpltzmMain_->keyMatch(QwtEventPattern::KeyAbort, &endZooming));
QCoreApplication::sendEvent(qwtpltMain_->canvas(), &endZooming);
//##note: Applying zooming and ending might be done with this event:
//##assume: Qt::LeftButton is QwtEventPattern::MouseSelect1.
//QMouseEvent endZooming(QEvent::MouseButtonRelease,
// qwtpltMain_->canvas()->mapFromGlobal(QCursor::pos()), Qt::LeftButton,
// Qt::LeftButton, Qt::NoModifier);
// Q_ASSERT(qwtpltzmMain_->mouseMatch(QwtEventPattern::MouseSelect1, &endZooming));
}
...
To copy to clipboard, switch view to plain text mode
Bookmarks