You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
7 years ago
|
#ifndef QTMVVM_BINDING_P_H
|
||
|
#define QTMVVM_BINDING_P_H
|
||
|
|
||
|
#include <QtCore/QObject>
|
||
|
#include <QtCore/QPointer>
|
||
|
|
||
|
#include "qtmvvmcore_global.h"
|
||
|
#include "binding.h"
|
||
|
|
||
|
namespace QtMvvm {
|
||
|
|
||
|
class BindingPrivate : public QObject
|
||
|
{
|
||
|
friend class QtMvvm::Binding;
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
static Binding bind(QObject *viewModel, const QMetaProperty &viewModelProperty,
|
||
|
QObject *view, const QMetaProperty &viewProperty,
|
||
|
Binding::BindingDirection type,
|
||
|
const QMetaMethod &viewModelChangeSignal,
|
||
|
const QMetaMethod &viewChangeSignal);
|
||
|
|
||
|
private Q_SLOTS:
|
||
|
void viewModelTrigger();
|
||
|
void viewTrigger();
|
||
|
|
||
|
private:
|
||
|
BindingPrivate(QObject *viewModel, const QMetaProperty &viewModelProperty,
|
||
|
QObject *view, const QMetaProperty &viewProperty);
|
||
|
|
||
|
void init();
|
||
|
void bindFrom(QMetaMethod changeSignal);
|
||
|
void bindTo(QMetaMethod changeSignal);
|
||
|
|
||
|
QPointer<QObject> viewModel;
|
||
|
QPointer<QObject> view;
|
||
|
QMetaProperty viewModelProperty;
|
||
|
QMetaProperty viewProperty;
|
||
|
|
||
|
void testReadable(const QMetaProperty &property, bool asView) const;
|
||
|
void testWritable(const QMetaProperty &property, bool asView) const;
|
||
|
void testNotifier(const QMetaProperty &property, bool asView) const;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif // QTMVVM_BINDING_P_H
|