PDA

View Full Version : qwebview browser do not response touchevent



hao jay
30th June 2016, 08:03
I am useing QWebView to create a customed web browser on win10. Everything goes well except touchevents. i had made a demo website to emit touchstart event before receiving a mouse click event(I used a opensourced third party lib by on github).

The demo website works fine on firefox . i can receive touchstart event and click event if I click on the demo website by firefox. but i can only receive click event on my customed QWebView browser.The touchstart event is never response on QWebView Browser.

Those a the situation right now and i have search a lot . Some people said that i should tried webview.setAttribute(Qt::WA_AcceptTouchEvents);

Some other people said that i should tried QGraphicsWebView instead of QWebView so i rewrote a simple QGraphicsWebView program as fellow.

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

const int width = 640;
const int height = 480;

QGraphicsScene scene;

QGraphicsView view(&scene);
view.setFrameShape(QFrame::NoFrame);
view.setVerticalScrollBarPolicy(Qt::ScrollBarAlway sOff);
view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlw aysOff);

QGraphicsWebView webview;
webview.resize(width, height);
webview.setAttribute(Qt::WA_AcceptTouchEvents);
webview.load(QUrl("http://192.168.1.2/test2"));

scene.addItem(&webview);

view.resize(width, height);
view.show();

return a.exec();
}

But none of them is working .is any who knows about it?any answer is welcome.Thank you

PS: i am useing Qt5.5.1