View Full Version : how can i initilize a qvector like this ?
elflord
18th April 2009, 17:36
QVector<QString> = {"ab","cd","ef","gg"}
is there a way to do thing similar like this ?
since using append involves too much typing when the Vector is large
thanks
jpn
18th April 2009, 18:10
You can write:
QVector<QString> = QVector<QString>() << "ab" << "cd" << "ef" << "gg";
But I would suggest using QStringList instead.
lyuts
18th April 2009, 18:31
QVector<QString> = {"ab","cd","ef","gg"}
is there a way to do thing similar like this ?
since using append involves too much typing when the Vector is large
thanks
At this point there is no way to do this. I know that new C++ standard will make it possible, but just with regular vectors. After that i think qt will have this.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.