0

This is a pretty simple and probably dumb question, but I have forgotten how to use QList QVariant::toList () const

QVariant s = this->page()->mainFrame()->evaluateJavaScript (QString ("Open(%1,%2)").arg (point.x()).arg (point.y()));

List<QVariant> x;
x = s.toList ();

Of course this is wrong, what is the correct way out? :redface:

Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411

2 Answers2

2

What you do is almost correct:

QList<QVariant> x = s.toList();

(Note the use of QList instead of List.)

mtvec
  • 17,846
  • 5
  • 52
  • 83
1

What you're doing is right. May be you can check if the variant contains a list before converting it. E.g:

QVariant variant = list;
if(variant.canConvert(QVariant::List))
{
    QList<QVariant> list_1 = variant.toList();
}
Chandan
  • 637
  • 1
  • 5
  • 13