Remove noisy warning for undefined QGradient preset

This runtime warning was recently introduced in the fix for an
assert/crash when creating a brush with an invalid Preset
value. However, that overlooked the usage where an unknown value is
passed to QGradient constructor, and the code afterwards checks if
the result is a NoGradient or not. It turns out that such usage is
already established as legitimate, including in the Qt Quick Rectangle
code, so this warning would be spit out continuously for perfectly
legal qml code.

Change-Id: Id60aed0817da0214b6cf17edd245f67e26470413
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Eirik Aavitsland 2019-04-05 09:02:28 +02:00
parent b404cd930e
commit 4e24bb24a2

View File

@ -1378,10 +1378,8 @@ QGradient::QGradient(Preset preset)
}();
const QJsonValue presetData = jsonPresets[preset - 1];
if (!presetData.isObject()) {
qWarning("QGradient: Undefined preset %i", preset);
if (!presetData.isObject())
return;
}
m_type = LinearGradient;
setCoordinateMode(ObjectMode);