Fix QPropertyAlias example, which did not compile

The QPropertyAlias example did not compile and comments were out of
sync with code. This patch fixes both.

Pick-to: 6.0
Change-Id: I5717f8df99f4936d0bcbae8df7d2d17e8086951d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Andreas Buhr 2020-12-07 09:52:42 +01:00
parent 3fbf922cc5
commit 0e96e1fb75

View File

@ -1151,10 +1151,10 @@ QString QPropertyBindingError::description() const
QPropertyAlias<QString> nameAlias(name);
QPropertyAlias<int> ageAlias(&age);
QPropertyAlias<QString> fullname;
fullname.setBinding([&]() { return nameAlias.value() + " age:" + QString::number(ageAlias.value()); });
QProperty<QString> fullname;
fullname.setBinding([&]() { return nameAlias.value() + " age: " + QString::number(ageAlias.value()); });
qDebug() << fullname.value(); // Prints "Smith age: 41"
qDebug() << fullname.value(); // Prints "John age: 41"
*name = "Emma"; // Marks binding expression as dirty