fix: do mouse gallery navigation on btn release
This commit is contained in:
parent
3a442b35f6
commit
7a1816cbac
|
@ -263,10 +263,14 @@ void GraphicsView::mouseMoveEvent(QMouseEvent *event)
|
|||
|
||||
void GraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::ForwardButton || event->button() == Qt::BackButton) {
|
||||
event->ignore();
|
||||
} else {
|
||||
QGraphicsItem *item = itemAt(event->pos());
|
||||
if (!item) {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
return QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
|
|
@ -272,15 +272,6 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
|
|||
event->accept();
|
||||
}
|
||||
|
||||
// It seems the forward/back mouse button won't generate a key event [1] so we can't use
|
||||
// QShortcut or QKeySequence to indicate these shortcuts, so we do it here.
|
||||
// Reference:
|
||||
// [1]: https://codereview.qt-project.org/c/qt/qtbase/+/177475
|
||||
if (event->buttons() & Qt::ForwardButton || event->buttons() & Qt::BackButton) {
|
||||
event->buttons() & Qt::BackButton ? galleryNext() : galleryPrev();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
return FramelessWindow::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
@ -304,6 +295,15 @@ void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
|||
{
|
||||
m_clickedOnWindow = false;
|
||||
|
||||
// It seems the forward/back mouse button won't generate a key event [1] so we can't use
|
||||
// QShortcut or QKeySequence to indicate these shortcuts, so we do it here.
|
||||
// Reference:
|
||||
// [1]: https://codereview.qt-project.org/c/qt/qtbase/+/177475
|
||||
if (event->button() == Qt::ForwardButton || event->button() == Qt::BackButton) {
|
||||
event->button() == Qt::BackButton ? galleryNext() : galleryPrev();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
return FramelessWindow::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user