0

I am using Qt signals and slots. I use the following signal-slot call.

connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finishedLoadNotification(bool)));

When the signal loadFinished is emitted, the slot finishedLoadNotification is called. In finishedLoadNotification, the variable 'ok' is always false. I want to know where the value of 'ok' is being set to false. From the code, I have not been able to find the value of 'ok'. Can you please help me in finding out where the variable 'ok' is set to false.

demonplus
  • 5,613
  • 12
  • 49
  • 68
mspms
  • 501
  • 1
  • 5
  • 8

2 Answers2

0

From Qt docs:

ok will indicate whether the load was successful or any error occurred.

So this variable is set when signal is emitted by QWebView. If ok = false, it just means that error happened and you need to process it. If ok = true, this means that everything went well.

If you want to get more details about your error you may look here:

How to get detailed error message when QTWebKit fails to load a page?

Community
  • 1
  • 1
demonplus
  • 5,613
  • 12
  • 49
  • 68
0

The boolean just means that error happened or not. You cant check the correct loading progress by handling the loading progress of your web page. Let's use loadProgress(int progress) connected with your own slot:

void MyCalss::handleProgress(int progress) {
     bool loaded = (progress == 100);
     if (_loaded != loaded) {  // State changed, let's emit a signal
         _loaded = loaded;
         emit webViewLoaded(loaded);
     }
}
mohabouje
  • 3,867
  • 2
  • 14
  • 28
  • The signal is emitted by the QT framework. We are not emitting the signal in the code. Hence we are not able to find out where the value of ok is set to false. – mspms Sep 26 '16 at 12:53