mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-22 21:53:03 +03:00
fix(browser): use button release for forward/back navigation
Also check if mouse pointer is within the webview Fixes #1564.
This commit is contained in:
parent
b8066c5540
commit
76187dc7d2
@ -206,16 +206,23 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
m_contextMenu->popup(event->globalPos());
|
m_contextMenu->popup(event->globalPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebView::handleMousePressEvent(QMouseEvent *event)
|
bool WebView::handleMouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
switch (event->button()) {
|
switch (event->button()) {
|
||||||
case Qt::BackButton:
|
case Qt::BackButton:
|
||||||
back();
|
// Check if cursor is still inside webview.
|
||||||
|
if (rect().contains(event->pos())) {
|
||||||
|
back();
|
||||||
|
}
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Qt::ForwardButton:
|
case Qt::ForwardButton:
|
||||||
forward();
|
if (rect().contains(event->pos())) {
|
||||||
|
forward();
|
||||||
|
}
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -251,8 +258,8 @@ bool WebView::eventFilter(QObject *watched, QEvent *event)
|
|||||||
{
|
{
|
||||||
if (watched->parent() == this) {
|
if (watched->parent() == this) {
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonRelease:
|
||||||
if (handleMousePressEvent(static_cast<QMouseEvent *>(event))) {
|
if (handleMouseReleaseEvent(static_cast<QMouseEvent *>(event))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ protected:
|
|||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool handleMousePressEvent(QMouseEvent *event);
|
bool handleMouseReleaseEvent(QMouseEvent *event);
|
||||||
bool handleWheelEvent(QWheelEvent *event);
|
bool handleWheelEvent(QWheelEvent *event);
|
||||||
|
|
||||||
QMenu *m_contextMenu = nullptr;
|
QMenu *m_contextMenu = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user