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. QVariant error but I'm not using QVariant
Forum Updated to NodeBB v4.3 + New Features

QVariant error but I'm not using QVariant

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 573 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.
  • W Offline
    W Offline
    whatabout
    wrote on last edited by
    #1

    I'm seeing this fatal compilation error about QVariant error but I'm not using QVariant. What's that about?

    error: use of deleted function ‘QVariant::QVariant(T) [with T = char*; typename std::enable_if<disjunction_v<std::is_pointer<_Tp>, std::is_member_pointer<_Tp> >, bool>::type <anonymous> = false]’
      688 |                         m_tableWidget->model()->setData(theTextIndex, theString, Qt::EditRole);
          |                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/qlocale.h:7,
                     from /usr/include/x86_64-linux-gnu/qt6/QtCore/qcalendar.h:10,
                     from /usr/include/x86_64-linux-gnu/qt6/QtCore/qdatetime.h:11,
                     from /usr/include/x86_64-linux-gnu/qt6/QtCore/qfileinfo.h:11,
                     from /usr/include/x86_64-linux-gnu/qt6/QtCore/qdir.h:9,
                     from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qfiledialog.h:8,
                     from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QFileDialog:1,
    
    Christian EhrlicherC 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Please provide a minimal example of your problem, the used Qt and compiler version.

      Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #3

      @whatabout said in QVariant error but I'm not using QVariant:
      You say:

      I'm not using QVariant.

      Pants on fire! You are using QVariantwhen you call:

      QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
      

      theStringis a char*, from which you can't construct a QVariant. That's why you get an error.
      Use a QStringinstead and it will compile.

      Software Engineer
      The Qt Company, Oslo

      W 1 Reply Last reply
      2
      • W whatabout

        I'm seeing this fatal compilation error about QVariant error but I'm not using QVariant. What's that about?

        error: use of deleted function ‘QVariant::QVariant(T) [with T = char*; typename std::enable_if<disjunction_v<std::is_pointer<_Tp>, std::is_member_pointer<_Tp> >, bool>::type <anonymous> = false]’
          688 |                         m_tableWidget->model()->setData(theTextIndex, theString, Qt::EditRole);
              |                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/qlocale.h:7,
                         from /usr/include/x86_64-linux-gnu/qt6/QtCore/qcalendar.h:10,
                         from /usr/include/x86_64-linux-gnu/qt6/QtCore/qdatetime.h:11,
                         from /usr/include/x86_64-linux-gnu/qt6/QtCore/qfileinfo.h:11,
                         from /usr/include/x86_64-linux-gnu/qt6/QtCore/qdir.h:9,
                         from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qfiledialog.h:8,
                         from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QFileDialog:1,
        
        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Please provide a minimal example of your problem, the used Qt and compiler version.

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

        Axel SpoerlA 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          Please provide a minimal example of your problem, the used Qt and compiler version.

          Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #3

          @whatabout said in QVariant error but I'm not using QVariant:
          You say:

          I'm not using QVariant.

          Pants on fire! You are using QVariantwhen you call:

          QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
          

          theStringis a char*, from which you can't construct a QVariant. That's why you get an error.
          Use a QStringinstead and it will compile.

          Software Engineer
          The Qt Company, Oslo

          W 1 Reply Last reply
          2
          • Axel SpoerlA Axel Spoerl

            @whatabout said in QVariant error but I'm not using QVariant:
            You say:

            I'm not using QVariant.

            Pants on fire! You are using QVariantwhen you call:

            QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
            

            theStringis a char*, from which you can't construct a QVariant. That's why you get an error.
            Use a QStringinstead and it will compile.

            W Offline
            W Offline
            whatabout
            wrote on last edited by
            #4

            @Axel-Spoerl
            Ah yes that was it, thanks.
            Stay warm...

            1 Reply Last reply
            0
            • W whatabout has marked this topic as solved on

            • Login

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