Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
// Copyright (C) 2021 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#ifndef PROPERTYTESTER_H
|
|
#define PROPERTYTESTER_H
|
|
|
|
#include <QObject>
|
|
#include <QProperty>
|
|
|
|
class PropertyTester : public QObject
|
|
{
|
|
Q_OBJECT
|
|
signals:
|
|
void xOldChanged();
|
|
void yOldChanged();
|
|
void xNotifiedChanged();
|
|
void yNotifiedChanged();
|
|
|
|
public:
|
|
PropertyTester() = default;
|
|
Q_PROPERTY(int xOld READ xOld WRITE setXOld NOTIFY xOldChanged)
|
|
Q_PROPERTY(int yOld READ yOld WRITE setYOld NOTIFY yOldChanged)
|
|
Q_PROPERTY(int x MEMBER x BINDABLE xBindable)
|
|
Q_PROPERTY(int y MEMBER y BINDABLE yBindable)
|
|
Q_PROPERTY(int xNotified MEMBER xNotified NOTIFY xNotifiedChanged BINDABLE xNotifiedBindable)
|
|
Q_PROPERTY(int yNotified MEMBER yNotified NOTIFY yNotifiedChanged BINDABLE yNotifiedBindable)
|
|
void setXOld(int i) {
|
|
if (m_xOld != i) {
|
|
m_xOld = i;
|
|
emit xOldChanged();
|
|
}
|
|
}
|
|
void setYOld(int i) {
|
|
if (m_yOld != i) {
|
|
m_yOld = i;
|
|
emit yOldChanged();
|
|
}
|
|
}
|
|
int xOld() { return m_xOld; }
|
|
int yOld() { return m_yOld; }
|
|
QProperty<int> x;
|
|
QProperty<int> y;
|
|
|
|
QBindable<int> xBindable() { return QBindable<int>(&x); }
|
|
QBindable<int> yBindable() { return QBindable<int>(&y); }
|
|
|
|
Q_OBJECT_BINDABLE_PROPERTY(PropertyTester, int, xNotified, &PropertyTester::xNotifiedChanged)
|
|
Q_OBJECT_BINDABLE_PROPERTY(PropertyTester, int, yNotified, &PropertyTester::yNotifiedChanged)
|
|
|
|
QBindable<int> xNotifiedBindable() { return QBindable<int>(&xNotified); }
|
|
QBindable<int> yNotifiedBindable() { return QBindable<int>(&yNotified); }
|
|
|
|
private:
|
|
int m_xOld = 0;
|
|
int m_yOld = 0;
|
|
};
|
|
|
|
#endif // PROPERTYTESTER_H
|