Note that there are some explanatory texts on larger screens.

plurals
  1. POQtWebPage - loadFinished() called multiple times
    primarykey
    data
    text
    <p>In my application, I have list view. Selecting another item in it, triggers an event:</p> <pre><code>connect(listView-&gt;selectionModel(), SIGNAL(currentChanged(const QModelIndex &amp;, const QModelIndex &amp;)), this, SLOT(item_changed(const QModelIndex &amp;, const QModelIndex &amp;))); void MainWindow::item_changed(const QModelIndex &amp; current, const QModelIndex &amp; previous) { qDebug() &lt;&lt; "\n" &lt;&lt; "item_changed(), caller: " &lt;&lt; sender()-&gt;objectName(); if (current.isValid()) { /* not so important code */ change_query(tokens.join("+")); } } </code></pre> <p>This calls another slot - change_query().</p> <pre><code>void MainWindow::change_query(QString newquery) { qDebug() &lt;&lt; "change_query(), caller: " &lt;&lt; sender()-&gt;objectName(); QUrl query (newquery); frame-&gt;load(query); connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loading_finished())); } </code></pre> <p>And finally, when page is fully loaded, it should call loading_finished()</p> <pre><code>void MainWindow::loading_finished() { qDebug() &lt;&lt; "loading_finished(), caller: " &lt;&lt; sender()-&gt;objectName(); } </code></pre> <p>But, to my surprise, the output is:</p> <pre><code>item_changed(), caller: "SelectionModel" change_query(), caller: "SelectionModel" loading_finished(), caller: "frame" item_changed(), caller: "SelectionModel" change_query(), caller: "SelectionModel" loading_finished(), caller: "frame" loading_finished(), caller: "frame" item_changed(), caller: "SelectionModel" change_query(), caller: "SelectionModel" loading_finished(), caller: "frame" loading_finished(), caller: "frame" loading_finished(), caller: "frame" item_changed(), caller: "SelectionModel" change_query(), caller: "SelectionModel" loading_finished(), caller: "frame" loading_finished(), caller: "frame" loading_finished(), caller: "frame" loading_finished(), caller: "frame" </code></pre> <p>As you can see, each time i change selection, another instance (?) of WebFrame is created and loaded, or page is loaded +1 time each loop. I spent last 2 hours finding out where the problem is and I don't see anything.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload