<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[get iterator with current qtconcurrent position]]></title><description><![CDATA[<p dir="auto">I would like to save the state of the qtconcurrent session in my program. I have found the function QFutureWatcher::progressValue which gives me an int with the current position, I do not know how to put this into an iterator for use with the overloaded function of qtconcurrent map function with begin and end to make it start from where it left off.</p>
<p dir="auto">Is this possible, or is there another way to get an iterator with the current position?</p>
<p dir="auto">I have tried</p>
<pre><code>    QStringList::iterator it = videofiles.begin();

    it += iterator; // iterator is an int with the positon I am trying to set
    statuslabel.setText("Processing video frames");
    videoscan = QtConcurrent::map(it,videofiles.end(), pvideo );

</code></pre>
<p dir="auto">but it does not seem to set the position of the iterator like it would seem</p>
]]></description><link>https://forum.qt.io/topic/62298/get-iterator-with-current-qtconcurrent-position</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 13:25:02 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/62298.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Jan 2016 01:48:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Tue, 05 Jan 2016 01:26:44 GMT]]></title><description><![CDATA[<p dir="auto">I just blanked out the qstring and added code to skip blank entries, thanks for the help</p>
]]></description><link>https://forum.qt.io/post/305602</link><guid isPermaLink="true">https://forum.qt.io/post/305602</guid><dc:creator><![CDATA[phirestalker]]></dc:creator><pubDate>Tue, 05 Jan 2016 01:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Mon, 04 Jan 2016 20:20:41 GMT]]></title><description><![CDATA[<p dir="auto">A map is a bit heavy container, but It can be whatever really. Just remember that you can't concurrently modify any container, not just the one you store data in, so you can't, for example, add something to a map shared by your concurrent callback invocations.<br />
The simplest would be a vector of bools the length of your data container.<br />
Another option is to store a bool next to the data itself i.e. instead of <code>QStringList</code> use a <code>QVector&lt;QPair&lt;bool, QString&gt;&gt;</code> or something like that.<br />
Yet another option, if you don't need the data afterwards (you said you were going to erase it anyway), is you could just empty the used strings (i.e. use <code>clear()</code> on them) or modify them in some way, like set first character to some marker value. This would have an additional benefit of avoiding a possible string reallocation.<br />
There's really a multitude ways to do that, so do whatever fits your case best. Just remember what you can't do.</p>
]]></description><link>https://forum.qt.io/post/305559</link><guid isPermaLink="true">https://forum.qt.io/post/305559</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Mon, 04 Jan 2016 20:20:41 GMT</pubDate></item><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Mon, 04 Jan 2016 20:02:36 GMT]]></title><description><![CDATA[<p dir="auto">I was afraid of that, do you have any ideas on how I could mark them as completed? perhaps I could make a qmap instead of a qstringlist and have one of the values be a bool so I can mark it finished, that would be less overhead if that would work.</p>
<p dir="auto">what do you think?</p>
]]></description><link>https://forum.qt.io/post/305554</link><guid isPermaLink="true">https://forum.qt.io/post/305554</guid><dc:creator><![CDATA[phirestalker]]></dc:creator><pubDate>Mon, 04 Jan 2016 20:02:36 GMT</pubDate></item><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Mon, 04 Jan 2016 17:13:41 GMT]]></title><description><![CDATA[<p dir="auto">Do you mean erase the item from the container inside the map callback (<code>pvideo</code> in your example)? Definitely don't do that. In fact don't ever modify the container (you may of course modify the contents) in any of QtConcurrent methods callbacks and in general in any algorithm that operates on iterators. As I mentioned before - you can mark in some way the processed elements and deffer any modifications to the container (resize, insert/delete elements etc.) until after the concurrent operations have finished.</p>
]]></description><link>https://forum.qt.io/post/305528</link><guid isPermaLink="true">https://forum.qt.io/post/305528</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Mon, 04 Jan 2016 17:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Mon, 04 Jan 2016 16:24:19 GMT]]></title><description><![CDATA[<p dir="auto">well my original idea was to just delete the item at the end of the map function, would that mess with qfuturewatcher keeping track of progress, because I have a progressbar.</p>
]]></description><link>https://forum.qt.io/post/305527</link><guid isPermaLink="true">https://forum.qt.io/post/305527</guid><dc:creator><![CDATA[phirestalker]]></dc:creator><pubDate>Mon, 04 Jan 2016 16:24:19 GMT</pubDate></item><item><title><![CDATA[Reply to get iterator with current qtconcurrent position on Mon, 04 Jan 2016 14:10:25 GMT]]></title><description><![CDATA[<p dir="auto">QtConcurrent does not guarantee the order in which the function will be applied and in what order the function will finish. In fact it's most unlikely that it would be applied in a linear fashion.<br />
QFutureWatcher::progressValue indicates the general amount of work done e.g. <em>"three out of ten"</em>, not <em>"first three"</em>.</p>
<p dir="auto">To do what you want you would need to inspect which items are already processed. You can mark them in some way as a last step of processing. I'll repeat - they are in no way guaranteed to be at the front of the container.<br />
Then you would just create another container with only the unprocessed items (use pointers if the data is large) and run <code>map()</code> on that.</p>
]]></description><link>https://forum.qt.io/post/305509</link><guid isPermaLink="true">https://forum.qt.io/post/305509</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Mon, 04 Jan 2016 14:10:25 GMT</pubDate></item></channel></rss>