Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get a long variable from QVariant
Forum Update on Tuesday, May 27th 2025

How to get a long variable from QVariant

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 268 Views
  • 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.
  • P Offline
    P Offline
    PMime
    wrote on last edited by
    #1

    When the type of a QVariant variable is QMetaType::Long, how can I get a C++ long variable?

    QVariant offers the method toLongLong, but the result is a qlonglong variable. Is it possible that toInt would be equivalent to toLong?

    Christian EhrlicherC 1 Reply Last reply
    0
    • P PMime

      When the type of a QVariant variable is QMetaType::Long, how can I get a C++ long variable?

      QVariant offers the method toLongLong, but the result is a qlonglong variable. Is it possible that toInt would be equivalent to toLong?

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      Then use QVariant::value<long>(). But since sizeof(long long) = sizeof(long) on all 64 bit platforms - why do you need it?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      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 Extensions
      • Unsolved