Hello to everyone,
I was investigating why in Konqueror middle-clicking on a bookmark in the 
bookmarks menu doesn't open the bookmark in a new tab like it used to do a 
while ago but opens it in the current tab and I found something which could be 
a bug in KBookmarks, a bug in Qt or a bug in Konqueror itself.

What Konqueror does is subclassing KBookmarkOwner and reimplementing 
KBookmarkOwner::openBookmark(). In this function, it checks the contents of 
the Qt::MouseButtons argument to determine if the action was triggered by a 
left click or middle click, then decide whether to open the bookmark in the 
current tab or a new tab. The condition is:

if (mb & Qt::MiddleButton) {
    ...
} else {
    ...
}

where mb is the Qt::MouseButtons argument.

The problem is that, regardless of whether I left-click or middle-click on a 
bookmark in the bookmark men, mb is always Qt::NoButton, which triggers the 
"else" clause, making the bookmark always open in the current tab. This seems 
to happen because QGuiApplication::mouseButtons() when called by a slot 
connected to the triggered() signal of an action in a menu returns 
Qt::NoButton.

I was going to create a bug report for KBookmarks, but then I thought that 
maybe the Konqueror code (which wasn't written by me) is using the 
Qt::MouseButton argument in a wrong way. I've found a work around for this 
issue (see [1]) but I still like to create a bug report for it, if it's indeed 
a bug. Could you please give me any hint about how to proceed? Is this likely 
to be a bug in QGuiApplication, a bug in KBookmarks or a bug in Konqueror?

Thanks in advance

Stefano

[1]: https://invent.kde.org/network/konqueror/-/merge_requests/426



Reply via email to