mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4356 Qt5 : Conversion of float value to text string does not work for all values
This commit is contained in:
parent
1adbc499d6
commit
a5a70dd83c
@ -152,7 +152,22 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
QString displayString;
|
||||
if (leab.m_displayString.isEmpty())
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 9, 0))
|
||||
bool valueOk = false;
|
||||
double value = uiField()->uiValue().toDouble(&valueOk);
|
||||
if (valueOk)
|
||||
{
|
||||
// Workaround for issue seen on Qt 5.6.1 on Linux
|
||||
int precision = 8;
|
||||
displayString = QString::number(value, 'g', precision);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayString = uiField()->uiValue().toString();
|
||||
}
|
||||
#else
|
||||
displayString = uiField()->uiValue().toString();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user