‘QLabel& QLabel::operator=(const QLabel&)’ is private error when using vectors
I get this error when I am trying to use a vector with values that are a custom class. The custom class inherits QLabel.
I have:
Code:
class SomeClass
: public QLabel {.
.
};
I create a vector of SomeClass:
Code:
vector<SomeClass> foo;
and then when I do:
Code:
foo.push_back(NULL);
I get this error. In eclipse there is a red underline under "class SomeClass : public QLabel {"
Re: ‘QLabel& QLabel::operator=(const QLabel&)’ is private error when using vectors
two errors here:
i) you can not copy QObjects (or subclasses like QWidgets), thus you can not put them in containers by value; you can use QList<SomeClass*>, though.
ii) NULL is a pointer, whereas your vector wants an object, which is why you'd get an error even if QLabel was copyable
HTH