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. Change-Id: I5717f8df99f4936d0bcbae8df7d2d17e8086951d Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 0e96e1fb752e0b7c99927e77e7ac3244b2e0c118) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0544d35656
commit
19fac4f9f2
@ -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