سؤال

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