QBindable example: Replace SpinBox connection with QBindable
Made this change because there was no example of the interaction between QBindable and non-bindable properties. Pick-to: 6.6 6.5 Task-number: QTBUG-114689 Change-Id: Ief7662f8af5e6fab32491418fa35f0daa937819d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
0be35f3a7b
commit
19b0800555
@ -11,6 +11,10 @@
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QSpinBox>
|
||||
#include <QProperty>
|
||||
#include <QString>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QBindable>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -49,9 +53,8 @@ int main(int argc, char *argv[])
|
||||
});
|
||||
|
||||
QSpinBox *ageSpinBox = w.findChild<QSpinBox *>("ageSpinBox");
|
||||
QObject::connect(ageSpinBox, &QSpinBox::valueChanged, [&](int value) {
|
||||
user.setAge(value);
|
||||
});
|
||||
QBindable<int> ageBindable(ageSpinBox, "value");
|
||||
user.bindableAge().setBinding([ageBindable](){ return ageBindable.value();});
|
||||
|
||||
QLabel *priceDisplay = w.findChild<QLabel *>("priceDisplay");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user