[Qt-interest] FW: Middle click event for QWebView?

Eric Clark eclark at ara.com
Thu Oct 29 15:45:18 CET 2009


Sorry Peter. Did not mean to send to you directly. -- Eric

From: Eric Clark
Sent: Thursday, October 29, 2009 9:34 AM
To: 'Peter'
Subject: RE: [Qt-interest] Middle click event for QWebView?

Peter,

I did this exact thing in my application. I respond to a middle click by opening the link in a new tab. The way that I found to do it was to override mousePressEvent in your QWebView and store the button that was pressed. By the time your linkClicked() single gets called you will have already stored the mouse button from your mousePressEvent. Now, you can determine what mouse button was pressed and you can do special stuff for the MidButton. Hope this helps.

Eric

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Peter
Sent: Thursday, October 29, 2009 12:18 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Middle click event for QWebView?

I need to detect when the user has clicked on a link in a QWebView with a middle mouse button. The only click signal I can see is the following:
- void linkClicked<http://doc.trolltech.com/4.5/qwebview.html#linkClicked> ( const QUrl & url )

Now, by the time I check QApplication::mouseButtons() it is too late and it just returns Qt::NoButton. What is the correct way of receiving a middle mouse linkClicked event?

Cheers,
Peter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091029/4a33230d/attachment.html 


More information about the Qt-interest-old mailing list