PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, April 28, 2022

[FIXED] How to avoid qWarning of float values

 April 28, 2022     c++, qml, qt, warnings     No comments   

Issue

I have these following code to set a variable:

void TypeLogVisualization::setGain(double gain)
{
qWarning("Floating point comparison needs context sanity check");
if (qFuzzyCompare(m_gain, gain) || gain < 1.0 || gain > 2.1)
    return;

m_gain = gain;
setPath();
emit gainChanged(m_gain);
}

The variable gain is set in QML File, like the code bellow:

function gainMinus(){
    log.setGain(log.gain-=0.1)
}

function gainPlus(){
    log.setGain(log.gain+=0.1)
}

log is object of a classe who contains "setGain", gain is a QProperty. I really want know how to avoid that warning: Floating point comparison needs context sanity check


Solution

Like everyone said, the only way it's remove that lines



Answered By - antuniooh
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing