PDA

View Full Version : QHttp cpu usage



BatteryCell
15th August 2007, 05:47
Hello, I was recently using QHttp and a QTextBrowser to load up a wikipedia web page based on a query, and with some queries it takes forever, and hogs the cpu; presumably this is because their are alot of images or something on the page and the text browser needs time to think. This brings me to my question, is there anyway to tell the Qhttp or the browser that it isn't particularly important to do it as fast as possible, it can do it slow as long as it doesn't use 80 percent cpu.

wysota
15th August 2007, 11:57
Can we see the actual code?

BatteryCell
29th August 2007, 01:33
Sure, but I think that I fixed it, I had to re-implement loadResource in order to have images appear, and I was just returning a new QString if it wasn't an image; yet if I just used QTextBrowser::loadResource(...) instead, then the program no longer shows the problem.

BatteryCell
30th August 2007, 01:11
Also I had some unexpected recursion going on in another widget's paintEvent, causing even more lag, so it wasn't even necessarily the Http. Basically, it fetched the http fine but when updating the widget it would enter paintEvent loops (because I was invoking paintEvent through setBackgroundRole unintentionally within the paintEvent). But, it's all fixed now :-).