qwebview

QWebView set border visible

China☆狼群 提交于 2019-12-11 02:35:30
问题 I want to make QWebView widget have borders in my layout and UI when running, similar to QTableView . Now it looks borderless and hidden. Is it even possible? 回答1: It's not possible to set border to QWebView. Instead you can place your QWebView inside another QWidget and set it's border. See example below (QtDesigner): Widgets hierarchy: Look inside QtDesigner: StyleSheet for QFrame: QFrame { border: 1px solid black; background: white; } 来源: https://stackoverflow.com/questions/21249403

How to get link URL on onClick in a QWebView?

与世无争的帅哥 提交于 2019-12-11 02:19:23
问题 How do I get a link's URL when clicking on the link? If I have a link in the A tag, it's simple: just connect linkClicked(const QUrl&) signal to specific slot. But if I have a table with an "onClick" event on its cell (generated html: "<td onClick=\"window.location.href='" + link_ + "';\" ......blahblahblah"), it's not working. Why? 回答1: As it's name suggests, the linkClicked signal is only emitted whenever a link is activated. But you can intercept all navigation requests by reimplementing

How to use QML - QWebView in Android

自作多情 提交于 2019-12-10 23:05:26
问题 I want to deploy one YouTube application in Android. But it only works on my computer, and it does not work on Android. It does not load any video. The problem is only with the QWebView. I used a code similar to this: http://doc.qt.io/archives/qt-5.5/qtwebkitexamples-webkitqml-youtubeview-example.html 回答1: Referring to Qt Documentations: Qt WebEngine is not available on mobile platforms While Qt WebView is actually useful for mobile platforms! .. as stated by Qt Here You can use QwebView with

Force QWebView to download web page content in a separate thread?

耗尽温柔 提交于 2019-12-10 17:47:19
问题 How can i force QWebView into downloading the webpage and related content in a separate thread? 回答1: You cannot easily. You could implement your own QNetworkAccessManager (see createRequest()) that offloads the work to a QNetworkAccessManager in another thread. What is your exact problem? Maybe it can be solved differently or a bug to Qt can be reported? 回答2: That's now the default behaviour so you can just relax and watch :) See Qt Earth Team Mix Feb 2011 and Threading support for

Overriding page replies in QWebView

六月ゝ 毕业季﹏ 提交于 2019-12-10 16:23:29
问题 I'm attempting to intercept a page/form request within Qt's QWebView and respond in some cases with alternative content. QNetworkReply* ngcBrowser::createRequest(Operation operation, const QNetworkRequest& request, QIODevice* ioDevice) { view->page()->setNetworkAccessManager(this); QNetworkReply* response = NULL; if (request.url().path().endsWith("ajax")) { response = QNetworkAccessManager::createRequest(operation, request, ioDevice); response->write("{ success: true }"); } else { response =

Qt: QWebview not displaying jpg, gif, png images on another machines

我怕爱的太早我们不能终老 提交于 2019-12-10 16:18:42
问题 Today I came across a very strange error with QWebView which I cannot resolve myself. I included a QWebView widget in my application. When I set a URL or a piece of HTML code to display (with QWebView::setUrl() or QWebView::setHtml() ), it works very well on my machine. It also works on all machines that have Qt installed, but not on those without it. I compiled a release build and included all necessary libraries as shared ( QtWebKit4.dll , QtNetwork4.dll etc.), so I guess my error lies in

Qt how to insert html into an editable QWebView at the cursor position?

与世无争的帅哥 提交于 2019-12-10 11:03:07
问题 I'm trying to use QWebView to implement a blog post editor. And I have some sample html snippets to insert into the editor by triggering menu actions. However, it's not convenient as QTextEdit to insert html. As for why I don't use QTextEdit , see my test code following: QTextEdit *edit = new QTextEdit; edit->insertHtml(tr("<div class=\"gci-hello\">Hello</div>")); qDebug() << edit->toHtml(); // --> the div tag disappeared So, if I use QWebView, the div tag will be reserved. But I can't find

How to call evaluateJavaScript() function from Qt?

牧云@^-^@ 提交于 2019-12-10 09:32:52
问题 I am not able to call a javascript function from QT . I am using the below code QT code : QWebFrame *frame = m_d->m_webView->page()->mainFrame(); frame->evaluateJavaScript("displayhello()"); Here `displayhello()` is the `Javascript` function defined in the HTML file. HTML code : <html> <head> <script type="text/javascript" src="" /> <script type="text/javascript"> function displaymessage(str) { alert(str); } function displayhello() { alert("Hello"); } </script> </head> <body> <form> <input

Using Qt C++ QWebView causes the GUI to run slowly.

夙愿已清 提交于 2019-12-07 20:00:25
问题 When the page loads through QWebView I've noticed that other elements of the program are beginning to run slowly, specifically the GUI. What is the best solution for addressing this problem? 回答1: I can't say I've ever had any appreciable slowdown of the rest of a user interface when using QWebView , even on quite underpowered SBCs. I wonder if there's something else going on that's slowing you down. Are you getting this problem with all pages you load, or just certain ones? One idea: you can

How to set QWebView's socket options?

半腔热情 提交于 2019-12-06 15:47:38
I want to set socket options such as receive buffer size,tcpNoDelay with QWebView.But i could not find any methods in QWebView to do this.I can't get the connection socket from QWebView,any idea? Thanks. QWebView doesn't use QTcpSocket directly. It uses QNetworkAccessManager. QNetworkAccessManager doesn't expose access to QTcpSockets. The only thing I can think of to control such things is to inherit QNetworkAccessManager, override createRequest method, that provides own QNetworkReply with own QTcpSocket inside. Note that your request with plain QTcpSocket may not work with proxy servers as