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:
parent
3fbf922cc5
commit
0e96e1fb75
@ -1151,10 +1151,10 @@ QString QPropertyBindingError::description() const
|
|||||||
QPropertyAlias<QString> nameAlias(name);
|
QPropertyAlias<QString> nameAlias(name);
|
||||||
QPropertyAlias<int> ageAlias(&age);
|
QPropertyAlias<int> ageAlias(&age);
|
||||||
|
|
||||||
QPropertyAlias<QString> fullname;
|
QProperty<QString> fullname;
|
||||||
fullname.setBinding([&]() { return nameAlias.value() + " age:" + QString::number(ageAlias.value()); });
|
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
|
*name = "Emma"; // Marks binding expression as dirty
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user