user1767754
user1767754

Reputation: 25094

QList proper way of using it

I want to poppulate a QList with QLabel Objects, so i've created a List of QLabel Objects.

QLabel *myLabel;    
QList<QLabel> *thumbNails;

but as QList awaits a const QLabel &, how can i append to the Qlist in the right ways, should i use a const_cast ?

Upvotes: 0

Views: 139

Answers (1)

Nazar554
Nazar554

Reputation: 4195

Most likely you put your * in a wrong place, which made thumbNails a pointer to a QList. You should store pointers to QLabel inside your list. Try this: QList<QLabel*> thumbNails;

Upvotes: 5

Related Questions