Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compare two QVariant
Qt 6.12 LTS is out! See what's new in the release blog

Compare two QVariant

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 758 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Alexey Serebryakov
    wrote on last edited by
    #1

    Hi guys, in my legacy there compare two QVariant but now operators like <, >, <=, >= was deprecated. Can anyone help me?

    QVariant q1(1);
    QVariant q2(2);
    
    bool result = q1 < 12; // operator < deprecated.
    

    Thanks a lot!

    jsulmJ 1 Reply Last reply
    0
    • A Alexey Serebryakov

      @jsulm Ohm thank you but that method since Qt 6.0. I'm using Qt 5.15.2. :-(

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Alexey-Serebryakov Then you will need to get the actual data from both variants and compare it.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • A Alexey Serebryakov

        Hi guys, in my legacy there compare two QVariant but now operators like <, >, <=, >= was deprecated. Can anyone help me?

        QVariant q1(1);
        QVariant q2(2);
        
        bool result = q1 < 12; // operator < deprecated.
        

        Thanks a lot!

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Alexey-Serebryakov You can use https://doc.qt.io/qt-6/qvariant.html#compare

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        A 1 Reply Last reply
        2
        • jsulmJ jsulm

          @Alexey-Serebryakov You can use https://doc.qt.io/qt-6/qvariant.html#compare

          A Offline
          A Offline
          Alexey Serebryakov
          wrote on last edited by
          #3

          @jsulm Ohm thank you but that method since Qt 6.0. I'm using Qt 5.15.2. :-(

          jsulmJ 1 Reply Last reply
          0
          • A Alexey Serebryakov

            @jsulm Ohm thank you but that method since Qt 6.0. I'm using Qt 5.15.2. :-(

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Alexey-Serebryakov Then you will need to get the actual data from both variants and compare it.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            3

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved