Address pr feedback

- Use AZ warning macros instead of #pragma warning
- std::numeric_limits->AZStd::numeric_limits
- IsClose->IsCloseMag
- AZ_Warning->AZ_Assert
main
Yuriy Toporovskyy 5 years ago
parent f1d2d380fa
commit c27b417761

@ -15,6 +15,7 @@
#include <AzQtComponents/Components/StyleManager.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/std/limits.h>
#include <QLabel>
#include <QStyleOptionSpinBox>
@ -66,7 +67,7 @@ const QString& VectorElement::label() const
void VectorElement::setValue(double newValue)
{
// Nothing to do if the value is not actually changed
if (AZ::IsClose(m_value, newValue, std::numeric_limits<double>::epsilon()))
if (AZ::IsCloseMag(m_value, newValue, AZStd::numeric_limits<double>::epsilon()))
{
return;
}
@ -97,7 +98,7 @@ void VectorElement::onSpinBoxEditingFinished()
if (m_value == deferredValue.prevValue)
{
AZ_Warning("VectorElement", !m_spinBox->hasFocus(), "Editing finished but the spinbox still has focus");
AZ_Assert(!m_spinBox->hasFocus(), "Editing finished but the spinbox still has focus");
setValue(deferredValue.value);
}
}

@ -24,11 +24,9 @@ namespace AzQtComponents
class Style;
#pragma warning(push)
// 'AzQtComponents::VectorElement::m_deferredExternalValue': class 'AZStd::optional<AzQtComponents::VectorElement::DeferredSetValue>' needs to
// have dll-interface to be used by clients of class 'AzQtComponents::VectorElement'
#pragma warning(disable:4251)
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
/*!
* \class VectorElement
@ -115,7 +113,8 @@ namespace AzQtComponents
private:
struct DeferredSetValue
{
double prevValue, value;
double prevValue;
double value;
};
// m_labelText must be initialised before m_spinBox. It is used by editFieldRect, which gets
@ -132,7 +131,7 @@ namespace AzQtComponents
AZStd::optional<DeferredSetValue> m_deferredExternalValue;
};
#pragma warning(pop)
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
//////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save