Deprecate wxPropertyGrid::DoubleToString().
Simply use wxNumberFormatter instead, this reduces code duplication and avoids bugs due to formatting inconsistencies in DoubleToString(). Closes #15625. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "wx/propgrid/propgrid.h"
|
||||
#include "wx/numformatter.h"
|
||||
|
||||
#define wxPG_CUSTOM_IMAGE_WIDTH 20 // for wxColourProperty etc.
|
||||
|
||||
@@ -667,6 +668,7 @@ wxFloatProperty::wxFloatProperty( const wxString& label,
|
||||
|
||||
wxFloatProperty::~wxFloatProperty() { }
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
// This helper method provides standard way for floating point-using
|
||||
// properties to convert values to string.
|
||||
const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
||||
@@ -738,6 +740,7 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
||||
|
||||
return target;
|
||||
}
|
||||
#endif // WXWIN_COMPATIBILITY_3_0
|
||||
|
||||
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
||||
int argFlags ) const
|
||||
@@ -745,11 +748,9 @@ wxString wxFloatProperty::ValueToString( wxVariant& value,
|
||||
wxString text;
|
||||
if ( !value.IsNull() )
|
||||
{
|
||||
wxPropertyGrid::DoubleToString(text,
|
||||
value,
|
||||
m_precision,
|
||||
!(argFlags & wxPG_FULL_VALUE),
|
||||
NULL);
|
||||
text = wxNumberFormatter::ToString(value.GetDouble(), m_precision,
|
||||
argFlags & wxPG_FULL_VALUE ? wxNumberFormatter::Style_None
|
||||
: wxNumberFormatter::Style_NoTrailingZeroes);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
Reference in New Issue
Block a user