Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Set QVariant as QMap

    General and Desktop
    2
    2
    1163
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      Imhotep last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        What does your code have to do with QVector ?

        Anyway

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

        But it's not a vector

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • First post
          Last post