Skip to content
  • 0 Votes
    3 Posts
    322 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);