我有一个QList和QVector.我填充Qlist,然后尝试复制到QVector.Ovector有一个fromList()方法.但它不起作用.
我的代码:
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);
Run Code Online (Sandbox Code Playgroud)
此代码后,vectorA返回空
我在Linux下使用Qt 4.8.5