I'm having problem with understanding some of QList behavior.
#include <QList>
#include <iostream>
using namespace std;
int main()
{
QList<double> *myList;
myList = new QList<double>;
double myNumber;
double ABC;
for (int i=0; i<1000000; i++)
{
myNumber = i;
myList->append(myNumber);
ABC = myList[i]; //<----------!!!!!!!!!!!!!!!!!!!
cout << ABC << endl;
}
cout << "Done!" << endl;
return 0;
}
I get compilation error cannot convert ‘QList’ to ‘double’ in assignment at marked line. It works when I use ABC = myList.at(i)
, but QT reference seems to say that at()
and [] operator
is same thing.
Does anybody know what makes the difference?
Thanks