Skip to content

Qt WebKit

Questions about Qt WebKit and related topics? Post here!
1.5k Topics 5.9k Posts
  • 0 Votes
    2 Posts
    2k Views
    If I understand the prblem correctly...you need to make your own network access manager and feed the web engine from the data. Sounds tricky since the data need to be buffered and the request won't have the same order. I would just build the bot on top of WebKit instead of mixing two tools.
  • QWebElement input click()

    27 Jan 2011, 17:50
    0 Votes
    6 Posts
    6k Views
    Done: http://bugreports.qt.nokia.com/browse/QTBUG-17029 Thanks :).
  • Robust re-fresh

    28 Jan 2011, 16:27
    0 Votes
    3 Posts
    4k Views
    Thanks, seems to work pretty well. Started the app, and renamed the web page, and web server log shows the app is trying to get the web page every minute just like I want. I'll test this for a while, and if this needs to be more reliable I'll follow your advice and implement my own slot, which uses loadFinished(bool ok) signal to check if the reload() slot was successful or not (since reload() returns nothing). Again, thanks for good and fast answer, Volker! -Paavo PS I'll attach the modified source file in case somebody else needs similar thing; here the URL is not so hard-coded, and there is even a bit silly error message if the URL is empty (or user exits the QInputDialog::getText() with escape. Also added query for the reload interval. @#include <QApplication> #include <QWebView> #include <QInputDialog> #include <QErrorMessage> #include <QTimer> int main(int argc, char *argv[]) { bool ret; QString text="http://an.example.com/weather/weather.php?scale=1.5"; QTimer timer; QApplication a(argc, argv); QWebView view; QErrorMessage error; int i=QInputDialog::getInt(0 /* parent */, "web page reloader (wpr)", "Enter refresh interval (1-60 minutes)", 5, 1, 60, 1, &ret, 0 /* window flags */); text=QInputDialog::getText(0 /* parent */, QObject::tr("Show web page - reload every %1 minute(s)").arg(i), "Enter URL and press Enter to continue (or ESC to abort)", QLineEdit::Normal, text, &ret, 0 /* window flags */); if(ret && !text.isEmpty()) { view.load(QUrl(text)); view.show(); /* or view.showMaximized(); */ QObject::connect(&timer, SIGNAL(timeout()), &view, SLOT(reload())); timer.setInterval(i * 60 * 1000); /* milliseconds */ timer.start(); } else { error.setFixedSize(400, 200); error.showMessage("Next time, then..."); } return a.exec&#40;&#41;; }@
  • QWebElement set and get attribute

    24 Jan 2011, 01:07
    0 Votes
    10 Posts
    10k Views
    [quote author="2beers" date="1296244812"] not sure if it's in the right section but you can change that if you want: https://bugs.webkit.org/show_bug.cgi?id=53319[/quote] That is all good. Thanks for the bug report.
  • 0 Votes
    4 Posts
    4k Views
    WebKit uses plenty of timers. It could be as simple as delayed layout in the page.
  • How to display specific part from website?

    13 Jan 2011, 06:37
    0 Votes
    13 Posts
    8k Views
    I posted some examples of a few ways of doing this kind of webslicing a while back in my blog: http://www.kdedevelopers.org/node/4086
  • 0 Votes
    3 Posts
    4k Views
    Thanks, Benjamin. stylesheet "body { -webkit-user-select: none; cursor: default; }" in QWebSettings::setUserStyleSheetUrl() solve the problem
  • 0 Votes
    7 Posts
    4k Views
    Ok, I found the "mistake" that I made: a file named imageformats has to be present with the respective files! I am just testing an application, not talking about deployment (yet). ;) Thank you both for your valuable answers. :)
  • QWebView+cgi

    19 Dec 2010, 22:25
    0 Votes
    6 Posts
    7k Views
    Hello, [quote author="nicola1" date="1293138310"]I solved, the problem was boa webserver and cgi. In the cgi i have a printf before @ printf("Content-Type:text/html\n\n");@ In this boa behaviour is different from apache.[/quote] As far I can go the problem is not a matter of Apache but the way the OS determine the string end. A few months ago I implemented my own version of the HttpRequestHeader parsing al the content to Hash POST and GET vars. Looking at the original implementation I could find a very interesting and simple OS strind end detector. Have a look to the source code: @void HttpRequestHeader::setOSCharEnd(QString request) { this->_osCharEnd = "\n"; int pos = request.indexOf(QLatin1Char('\n')); if (pos > 0 && request.at(pos - 1) == QLatin1Char('\r')) { this->_osCharEnd = "\r\n"; } }@ request is a raw http request sended by a browser to my server...
  • How to delete properly a QWebView &#63;

    13 Jul 2010, 13:57
    0 Votes
    14 Posts
    15k Views
    Qt 4.7 has less memory leak than 4.5.3 but still is loosing a lot of memory!! Since I know thats hard to believe I'm preparing a demo...
  • 0 Votes
    12 Posts
    6k Views
    yeah - I am doing that too.. does anyone know the expected behaviour when an new frame (iframe) is created? I have connected a function to the page "frameCreated" signal - this is called for the new frame and I call newFrame->addToJavaScriptWindowObject() to add my custom object. I also connect to the javaScriptWindowObjectCleared signal for the new frame. Sometimes this signal goes off immediately resulting in a second call to addToJavaScriptWindowObject() - is this expected?
  • Qt 4.7 WebPage is a widget??

    5 Jan 2011, 08:27
    0 Votes
    19 Posts
    11k Views
    [quote author="DavidGOrtega" date="1294502496"]I see... thats why I noted it so slow... but the returned types are still different... why aren't they returned as QVariant?[/quote] Well, actually, returning QVariant was a big design mistake of QtWebKit. If the javascript team manage to integrate QtScript to QtWebKit, we will deprecate the return as QVariant. Simple example you can't do with QVariant: -return a Javascript object and interact with it (call functions, set properties, etc) -return a JS function() and then call it from C++, or even pass it back to the engine
  • 0 Votes
    12 Posts
    12k Views
    As Benjamin stated the only way to do this is using a factory pattern the trick here is returning the object created... @QVariant factory::createFSInstance() //this is a slot { FileSystem* fs = new FileSystem(); this->_webView->mainFrame()->addToJavaScriptWindowObject("fsInstance", fs); return this->_webView->mainFrame()->evaluateJavascript("fsInstance;"); }@ in javascript looks: @var fs = factory.createFSInstance(); fs.read(filename);@ If you have a look to any CommonJS implementation like node.js they use require as a reserved method and of course the new desired impementation exists thought javascript objects that do what I have exposed loaded in a bootstrap.js. As I have said have a look to node.js to have an idea of what is happening behind
  • Login gmail problem

    21 Dec 2010, 08:04
    0 Votes
    4 Posts
    4k Views
    The release branches are on git: http://gitorious.org/+qtwebkit-developers/webkit/qtwebkit For some reason, QtWebKit 2.1 has not been released yet. It is very stable already, I doubt much will change before the release.
  • 0 Votes
    6 Posts
    5k Views
    Thanks for your information and it helps.
  • 0 Votes
    5 Posts
    4k Views
    This document will help you about "QtWebKit":http://doc.qt.nokia.com/4.7-snapshot/qtwebkit.html And how you can use QtWebKit in your mobile application is given here : "hands on introduction":http://www.forum.nokia.com/document/Mobile_Hands-on_Labs/Qt/QtWebKit/
  • 0 Votes
    6 Posts
    5k Views
    [quote author="seadak" date="1293499700"]Thank you for the above, I mean when I use a jsp page <form> tag, I put a <input type=button clicked="callaJS()"> in <form> </ form> ,Like <form> <input type=button clicked="callaJS()"> </ form> At this time, callaJS () does not perform, but when I put <input type=button clicked="callaJS()"> outside of <form> </ form> , Like <form> ... </ form> <input type=button clicked="callaJS()"> ... callaJS () can do; in qt4. 6 do not have this problem, this issue found in 4.7; Do you have the same experience?Help me[/quote] I think you should file a bug on the "Qt Bug Tracker":http://bugreports.qt.nokia.com/secure/Dashboard.jspa but I am not sure if this could be a Qt 4.7.
  • Bind WebKit to another interface

    22 Dec 2010, 22:54
    0 Votes
    8 Posts
    4k Views
    Ok, you need get access to socket of QNetworkAccessManager class. Then you can set your networkAccessManager for QWebPage. But I not have any ideas, how you can do it.
  • QGraphicswebview and plugin

    8 Dec 2010, 08:27
    0 Votes
    8 Posts
    5k Views
    Well that is possible, but not guaranteed in my opinion because what if the initialization for the loadFinished() signal fails, then all of your other signals which you are connecting against this will also fail. So If I were you I would have gone with onLoad().
  • Problems with Cache

    22 Dec 2010, 01:12
    0 Votes
    5 Posts
    4k Views
    Yes, the files show up in the cache folder but at this point I think it is something in the server set up. I'll let you know when I figure out more.