Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. error: conversion from 'double' to 'QChar' is ambiguous
Forum Updated to NodeBB v4.3 + New Features

error: conversion from 'double' to 'QChar' is ambiguous

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 3 Posters 4.4k 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.
  • M Offline
    M Offline
    Mohit Tripathi
    wrote on last edited by
    #1

    Hi,

    I am trying to put the double or float value but I am getting the error. How can I define this if values is not an integer?

    QString data9 = ui->lineEdit10_14->text();
    If(**data9<=0.8**||data9>=1.2)
    {
         msg.setText("Range: Over should be 0.8 and 1.2\n");     
                 msg.exec();
                 return;  
             }
    jsulmJ J.HilkJ 2 Replies Last reply
    0
    • M Mohit Tripathi

      Hi,

      I am trying to put the double or float value but I am getting the error. How can I define this if values is not an integer?

      QString data9 = ui->lineEdit10_14->text();
      If(**data9<=0.8**||data9>=1.2)
      {
           msg.setText("Range: Over should be 0.8 and 1.2\n");     
                   msg.exec();
                   return;  
               }
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mohit-Tripathi So, you're trying to compare a QString with double/float? How is this going to work?
      Convert the string with number to double.
      Isn't it really easy to find it in documentation? https://doc.qt.io/qt-5/qstring.html#toDouble

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

      1 Reply Last reply
      5
      • M Mohit Tripathi

        Hi,

        I am trying to put the double or float value but I am getting the error. How can I define this if values is not an integer?

        QString data9 = ui->lineEdit10_14->text();
        If(**data9<=0.8**||data9>=1.2)
        {
             msg.setText("Range: Over should be 0.8 and 1.2\n");     
                     msg.exec();
                     return;  
                 }
        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #3

        Hi @Mohit-Tripathi

        what you're trying to do here is comparing a QString with a double value, that can't work, those are fundamentally different.

        You'll have to first convert the string to a double. The QString class offers a build in function for that:
        https://doc.qt.io/qt-5/qstring.html#toDouble

        you should use that first


        Edit: snapped by @jsulm 😉


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        5

        • Login

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