Skip to content
  • Is it possible to have duplicate in QSet/Hash ?

    Solved General and Desktop qset qhash duplicate
    7
    0 Votes
    7 Posts
    407 Views
    A
    To be honnest, looking more deeply in Qhash than i'v done before, it appered that it was the perfect tool for a bit later. Once my thing is working and I have fixed my own mess, I'll take a look at improving what mess have been made before me.
  • 0 Votes
    3 Posts
    622 Views
    A
    @SGaist Hey thank you, I removed the QObject heredity for every class since I don't need ^^ I made every copy constructor and operator= overload not usable (= delete) I made for each a static clone() method which makes a deep copy CueTrack * CueTrack::clone(CueTrack *other) { if(!other) return nullptr; CueTrack * trackToReturn = new CueTrack(); if(other->_animationsList) { delete trackToReturn->_animationsList; trackToReturn->_animationsList = AnimationsSubTrack::clone(other->_animationsList); } QVectorIterator<FxSubTrack*> it(other->_fxList); while (it.hasNext()) { auto p = it.next(); FxSubTrack * fx = FxSubTrack::clone(p); trackToReturn->appendFx(fx); } if(other->_zoneChase) trackToReturn->_zoneChase = ZoneChaseSubTrack::clone(other->_zoneChase); return trackToReturn; }
  • 0 Votes
    4 Posts
    7k Views
    Chris KawaC
    Then it's just a matter of removing from the list items that are already added. Something like this: //get the list from somewhere QStringList fileNames = ... //remove the temp item you mentioned fileNames.removeOne(temp); //remove the items already in the widget int numItems = listWidget->count(); for(int i = 0; i < numItems; ++i) fileNames.removeOne(listWidget->item(i)->text()); //now that the list is "clean" all there is left to do is add the new items listWidget->addItems(fileNames);