In QWebView if I drag/copy an image and drop/paste into a QWebView, it shows the path of image instead of image. How can I get this file path and show the image?

有帮助吗?

解决方案

Connect your webview page's network access manager finished signal with replyfinished slot of your class.

connect(webviewptr->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));

In replyFinished you will get the QNetworkReply pointer for all resources like images, video etc. By using function url of QNetworkReply class you can check what kind of resources they are and read the content of those files.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top