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++?
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:
Qt Code:
class point{ public: point(); double lX; // Local x&y double lY; double gX; // global x&y double gY; };To copy to clipboard, switch view to plain text mode
It should work without problems. What is the first error message you get?
You have to store them as pointers.
N3wb (17th April 2010)
Bookmarks