So I'd like to make a template
class in C++ Qt. The problem is that I'm using signals
/slots
in this class.
My class header looks like
template <class T>
class Container : public QObject
{
Q_OBJECT
protected:
QVector<T*> vec;
public:
Container();
~Container(void);
int getSize() const;
T * operator[] (int);
T * operator() (int);
void operator <<(T*);
void operator >>(T*);
bool exists(T*);
signals:
void updateTable();
void updateTable(int,int);
void sizeSignal(int);
public slots:
void insert(T*);
void insert(int, T*);
void edit(QTableWidgetItem*);
void remove(int);
};
How to make it work?
Tried something like this:
template <class T>
class Container : public ContainerSignalsSlots
{
public:
Container();
~Container(void);
int getSize() const;
T * operator[] (int);
T * operator() (int);
void operator <<(T*);
void operator >>(T*);
bool exists(T*);
};
class ContainerSignalsSlots : public QObject
{
Q_OBJECT
protected:
QVector<T*> vec;
signals:
void updateTable();
void updateTable(int,int);
void sizeSignal(int);
public slots:
void insert(Class1*);
void insert(int, Class1*);
void insert(Class2*);
void insert(int, Class2*);
void edit(QTableWidgetItem*);
void remove(int);
};
But how I'm supposed to handle with QVector
?