class B : public QObject{ Q_OBJECT B(QObject *parent=0); //... //Сигналы, слоты, переменные, геттеры, сеттеры итп //...};class A{ //... B val1; B val1; //...};class CMain : public QObject{ Q_OBJECT CMain(QObject *parent=0); //... private: QVector<A> list;}
C++ (Qt)class B : public QObject{ Q_OBJECTpublic: B(QObject *parent=0) : QObject(parent) {} ~B() {}}; class A{public: A() {} ~A() {} private: B val1; B val2;}; class CMain : public QObject{ Q_OBJECTpublic: CMain(QObject *parent=0) : QObject(parent) {} ~CMain() {} private: QVector<A> list;};
class B : public QObject{ Q_OBJECTpublic: B(QObject *parent=0) : QObject(parent) {} ~B() {}}; class A{public: A() {} ~A() {} B val1; B val2;};#include <QVector>class CMain : public QObject{ Q_OBJECTpublic: CMain(QObject *parent=0) : QObject(parent) {} void test(){ if(!list.empty()) A val = list[0]; } ~CMain() {} private: QVector<A> list;};
C++ (Qt)class CMain : public QObject{ Q_OBJECTpublic: CMain(QObject *parent=0) : QObject(parent) {} void test(){ if(!list.empty()) A *val = list[0]; } ~CMain() {} private: QVector<A *> list;};