Note that there are some explanatory texts on larger screens.

plurals
  1. POForce update of QTListWidget to add/remove elements
    text
    copied!<p>I'm attempting to wrap a GUI around an existing management console app. The main function is to search for network devices, which is given a timeout and is essentially a blocking call until the timeout has expired (using sleep to do the blocking). In this example the call is <code>this-&gt;Manager-&gt;Search(...)</code>.</p> <p>My issue is that I want the QListWidget to display "Searching..." while the search is taking place, and then update with the results at the completion of the search. My on-click code for the <code>Search</code> button is as follows:</p> <pre><code>void ManagerGUI::on_searchButton_clicked() { ui-&gt;IPList-&gt;clear(); new QListWidgetItem(tr("Searching..."), ui-&gt;IPList); ui-&gt;IPList-&gt;repaint(); this-&gt;Manager-&gt;Search(static_cast&lt;unsigned int&gt;(this-&gt;ui-&gt;searchTime-&gt;value()*1000.0)); ui-&gt;IPList-&gt;clear(); if(this-&gt;Manager-&gt;GetNumInList() != 0) this-&gt;displayFoundInList(this-&gt;Manager-&gt;GetFoundList()); else new QListWidgetItem(tr("No Eyes Found"), ui-&gt;IPList); ui-&gt;IPList-&gt;repaint(); } </code></pre> <p>When I hit the button, the <code>QListWidget</code> <code>IPList</code> does not update until after the timeout has taken place (and I assume until after this callback has terminated). Does anyone have any suggestions? I was under the impression that calling <code>ui-&gt;IPList-&gt;repaint()</code> would cause an immediate redraw of the list.</p> <p>Additional info:</p> <ul> <li>QT Version 5.1.0 32-Bit</li> <li>Compiled using VS2012</li> <li>Running on Win7 Pro 64-bit (but to be ported to OSX and Linux, so nothing win-specific please)</li> </ul>
 

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