QPropertyAnimation: share some code

Collapse the two qWarnings() into one by just storing what is different between them.

Saves more than 400b in text size on optimized AMD64 Linux GCC 9.1 builds.

Change-Id: I16489d6165a550a9ad4ce6a77ca736a1d17a8c8a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2019-05-29 15:06:35 +02:00
parent 2f542dd996
commit 6e121d81cb

View File

@ -277,15 +277,20 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
if (oldState == Stopped) {
d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData()));
//let's check if we have a start value and an end value
const char *what = nullptr;
if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) {
qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value",
d->propertyName.constData(), d->target.data()->metaObject()->className(),
qPrintable(d->target.data()->objectName()));
what = "start";
}
if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) {
qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value",
if (what)
what = "start and end";
else
what = "end";
}
if (Q_UNLIKELY(what)) {
qWarning("QPropertyAnimation::updateState (%s, %s, %ls): starting an animation without %s value",
d->propertyName.constData(), d->target.data()->metaObject()->className(),
qPrintable(d->target.data()->objectName()));
qUtf16Printable(d->target.data()->objectName()), what);
}
}
} else if (hash.value(key) == this) {