Set QVariant as QMap

  • Can I set a QVariant as a QVector? This is my attempt

    QMap<QString, int> row;
    QVariant v(row);

    But Qt Creator rise this error:

    error: no matching function for call to 'QVariant::QVariant(QMap<QString, int>&)'

    Can you help me? I've already read all of the examples, but there is nothing about this.

  • Lifetime Qt Champion


    What does your code have to do with QVector ?


    @QVariant v = QVariant::fromValue(row);@

    But it's not a vector

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.