QVector <myrecord> val1;QVector <myrecord> val2;QVector <myrecord> val3;...
val1.push_back(new_myrecord);
val2.push_back(val2.last());val3.push_back(val3.last());...
val1.push_back(new_myrecord);val2.push_back(val2.last());val3.push_back(val3.last());
val1.push_back(val1.last());val2.push_back(new_myrecord);val3.push_back(val3.last());
C++ (Qt)typedef QVector<myrecord> TVecl;typedef QVector <TVec *> TControl;TControl theControl;theControl.push_back(&val1); theControl.push_back(&val2);theControl.push_back(&val3); ...
C++ (Qt)void Add2All( TControl & theControl, TVec & dst, const myrecord & rec ){ for (int i = 0; i < theControl.size(); ++i) { if (theControl[i] == &dst) theControl[i]->push_back(rec); else { Q_ASSERT(theControl[i]->size()); theControl[i]->push_back(theControl[i]->back()); } }}
someFunction { Sender.push_back(); }class FVector : public QVector {public slots: void push_back(value) { emit valueChanged(value); //отсылаем всем кроме источника(как сделать?) на повтор последнего}signals: void valueChanged();}public: FVector() { connect(sender, &Sender::valueChanged, someFunction(&Sender));}
C++ (Qt)class FVec : public QObject, public QVector<myrecord> { Q_OBJECT// тут рисуете слоты/сигналы};
C++ (Qt)class FVec : public QObject, public QVector<myrecord> { Q_OBJECT };
C++ (Qt)class BUHRecords : public QObject, public QVector<buhrecord> { Q_OBJECTpublic: BUHRecords() { QObject::connect(this, &BUHRecords::valueChanged, push_last); } void push_last() { QVector::push_back(QVector::last()); } public slots: void push_back(buhrecord irecord) { QVector::push_back(irecord); emit valueChanged(); QVector::pop_back(); //remove duplicate because signal was worked } signals: void valueChanged(); };