I have a QWebView which loads some webpage, but the problem when mouse is pressed and dragged it selectes everything which comes in its way.
Is there any way I can get rid of this?? I dont want text and other items to be selected.,
If I restrict mouseMove and mousePress then it other functionality with these event also gets restricted which is what I dont want.
I tried alot to find any way in QWebView/Qwebpage but doesnt find any, do i need to do something in webkit?
Please help
If you control the content that is being loaded, you can use css:
body { -webkit-user-select: none; }
Otherwise you might add a user stylesheet with this rule.
If you want a QT answer, maybe this is an option:
class MyWebView : public QWebView
{
protected:
virtual void mouseMoveEvent(QMouseEvent *) { /* dummy implementation */ }
public:
MyWebView(QWidget* parent) : QWebView(parent) { }
}
It overrides the original function and achieves that only press and release events are available in your webview. This worked for me on QT 4.8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With