diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-12-07 09:52:42 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-07 19:27:19 +0000 |
commit | 19fac4f9f245e022f3698468bf8d0f911a7de4a3 (patch) | |
tree | a0c8aa4f8fdd569243d69a08a67884893270563b /src/corelib/kernel/qproperty.cpp | |
parent | 0544d35656ed343375fcc3bafaf15329f23a854d (diff) |
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>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r-- | src/corelib/kernel/qproperty.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 759ef37c32..d2fd572b69 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -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 |