No known conversion from QList<QVariant> to QList<bool>

  c++, qt

I have stuck with simple problem and can not find solution.
I want to convert QList<QVariant> to QList<bool>.

QList<QVariant> listVariants;
listVariants << QVariant(true) << QVariant(false) << QVariant(true);

QList<bool> listBools;
listBools = listVariants;

Is this possible to do it with 1 line or cast somehow from QList<QVariant> to QList<booL> or I should iterate over the QList<QVariant> and call .toBool() method on each element and then add it in the QList<bool>?

Thanks in advance.

Source: Windows Questions C++

LEAVE A COMMENT