Skip to content
QtWS25 Last Chance
  • What should I be replacing foreach with?

    Solved General and Desktop foreach iterators
    20
    1 Votes
    20 Posts
    6k Views
    mmikeinsantarosaM
    @mmikeinsantarosa FWIW, I used parameters: static constexpr int scale = 10000, iterations = 100 * scale; And the non-detaching iterator was 24 times faster Detaching: 1247 Non-detaching: 51 So this is a good thing to know!
  • 0 Votes
    2 Posts
    882 Views
    VRoninV
    form http://doc.qt.io/qt-5/qmapiterator.html The first call to next() advances the iterator to the position between the first and second item, and returns the first item; so first call to next returns the first item (0), the second call returns the second item (1) the first call to previous returns the first item again (1) using this image: [image: javaiterators1.png] next and previous return the item they jumped over so if you call next 1 time it returns A as it jumps over A, the second time it jumps over B, if you then call previous it jumps over B again so it returns b again
  • 0 Votes
    6 Posts
    2k Views
    M
    @kshegunov said: You're missing the fact that QWidget and its descendants aren't reentrant. Actually, I missed more than that... I completely miss the fact that, when dealing with QWidget or simillar + threads, that exactely when I should have used signal/slot mechanism... I feel dumb about it, but anyway, the Crawler object now crawls using Qt::Concurrent and send a signal with the text to add to the QListWidget, and then a MainWidget's slot is called to create and add the item. Thanks for your help