Maybe I'm just doing something wrong, but when I try to create a QVector that holds a type of objects I get a whole slew of errors. Can a QVector hold objects, like in in standard C++?
Printable View
Maybe I'm just doing something wrong, but when I try to create a QVector that holds a type of objects I get a whole slew of errors. Can a QVector hold objects, like in in standard C++?
Yes, why not ?
What errors are you getting ? Without knowing the error we cant say anything.
Hi, you won't be able to store an object of an QObject derived class because those classes do not implement the = operator. Only assignable classes can be stored in QVector.
Ginsengelf
It is a custom class I was wanting to store. You're saying this isn't possible, right?
In a non-Qt C++ program I defined the class as:
Code:
class point{ public: point(); double lX; // Local x&y double lY; double gX; // global x&y double gY; };
It should work without problems. What is the first error message you get?
You have to store them as pointers.