Give the QGradient presets ObjectMode coordinate mode by default
ObjectBoundingMode has inconsistent behavior and is deprecated in favor of ObjectMode. Change-Id: I748f6283f3db5869bb9a67c08bf5f16abc6f95b0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
bafa5a14dd
commit
1ed0b2170d
@ -1352,7 +1352,7 @@ QGradient::QGradient()
|
|||||||
Constructs a gradient based on a predefined \a preset.
|
Constructs a gradient based on a predefined \a preset.
|
||||||
|
|
||||||
The coordinate mode of the resulting gradient is
|
The coordinate mode of the resulting gradient is
|
||||||
QGradient::ObjectBoundingMode, allowing the preset
|
QGradient::ObjectMode, allowing the preset
|
||||||
to be applied to arbitrary object sizes.
|
to be applied to arbitrary object sizes.
|
||||||
*/
|
*/
|
||||||
QGradient::QGradient(Preset preset)
|
QGradient::QGradient(Preset preset)
|
||||||
@ -1380,7 +1380,7 @@ QGradient::QGradient(Preset preset)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_type = LinearGradient;
|
m_type = LinearGradient;
|
||||||
setCoordinateMode(ObjectBoundingMode);
|
setCoordinateMode(ObjectMode);
|
||||||
setSpread(PadSpread);
|
setSpread(PadSpread);
|
||||||
|
|
||||||
const QJsonValue start = presetData[QLatin1Literal("start")];
|
const QJsonValue start = presetData[QLatin1Literal("start")];
|
||||||
|
@ -331,7 +331,7 @@ void tst_QBrush::gradientPresets()
|
|||||||
{
|
{
|
||||||
QGradient gradient(QGradient::WarmFlame);
|
QGradient gradient(QGradient::WarmFlame);
|
||||||
QCOMPARE(gradient.type(), QGradient::LinearGradient);
|
QCOMPARE(gradient.type(), QGradient::LinearGradient);
|
||||||
QCOMPARE(gradient.coordinateMode(), QGradient::ObjectBoundingMode);
|
QCOMPARE(gradient.coordinateMode(), QGradient::ObjectMode);
|
||||||
|
|
||||||
QLinearGradient *lg = static_cast<QLinearGradient *>(&gradient);
|
QLinearGradient *lg = static_cast<QLinearGradient *>(&gradient);
|
||||||
QCOMPARE(lg->start(), QPointF(0, 1));
|
QCOMPARE(lg->start(), QPointF(0, 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user