Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
None
-
None
Description
As for today we can't do this
QList<int> li;
QList<QVariant> lv;
lv = (QList<QVariant>) li;
So my suggestion is to let possible to convert a QList<int> (or any QVariant compatible variable) into a QList<QVariant>.
So we can't do this also:
QList<int> li;
QVariant v(li);
We can only do this:
QList<QVariant> lv; QVariant v(lv);
Secondly, the same thing for the reverse procedure:
For example we can't do
QList<QVariant> lv; QVariant v(lv); QList<int> li = v.toList(int); // to convert a QVariant that containing a QList into a QList of int //instead we can only do this QList<QVariant> lv2 = v.toList();
So my suggestion is to enrich methods of converting a QVariant with the method
QList<T> QVariant::toList(T) //T is any type that can be contained in a QVariant)
Use case:
For example in a QSettings we can have to save QList<int>, QList<QUrl>, QList<QDate>, QList<QIcon> etc...
But at this time we are not able to do this
QList<QUrl> urlListHistory; //....do something to fill the QList<QUrl> QSettings param->setValue("urlListHistory", urlListHistory);