Populating QVector from QList
问题 I have a QList and QVector. I populate Qlist and then tried to copy to QVector. Ovector has a fromList() method. But it do not work. My code : QList<int> listA; QVector<int> vectorA; //I also tried QVector<int>vectorA(100); for(int i=0; i<100; i++) { listA.append(i); } vectorA.fromList(listA); After this code vectorA returns empty I use Qt 4.8.5 under Linux 回答1: You should write: vectorA = QVector::fromList(listA); as fromList is a static method of the class QVector . The code you wrote