Solved error: conversion from 'double' to 'QChar' is ambiguous
-
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; }
-
@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 -
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#toDoubleyou should use that first
Edit: snapped by @jsulm 😉