1 #ifndef QTMVVM_QQMLMVVMBINDING_H 2 #define QTMVVM_QQMLMVVMBINDING_H 4 #include <QtCore/QObject> 5 #include <QtQml/QQmlParserStatus> 7 #include <QtMvvmCore/Binding> 105 Q_PROPERTY(BindingDirection type READ type WRITE setType NOTIFY
typeChanged)
116 Q_FLAG(BindingDirection)
119 explicit QQmlMvvmBinding(
QObject *parent =
nullptr);
122 void classBegin()
override;
124 void componentComplete()
override;
127 BindingDirection type()
const;
129 Q_INVOKABLE
bool isValid()
const;
136 void setType(BindingDirection type);
161 void viewModelWasSet();
165 bool _completed =
false;
166 bool _viewSet =
false;
167 bool _viewModelSet =
false;
173 BindingDirection _type =
TwoWay;
174 QString _viewModelChangeSignal;
180 #endif // QTMVVM_QQMLMVVMBINDING_H All changes on both sides are propagated to the other one.
A QML class to create a local mvvm multiway binding.
void viewChanged(QObject *view)
NOTIFY accessor for MvvmBinding::view.
All changes done to the view are propagated to the viewmodel.
Only initialize the view by settings it to the viewmodels value on creation.
All changes done to the viewmodel are propagated to the view.
QString viewModelProperty
The property of the viewmodel to use in the binding.
void unbind()
Remove the binding by disconnecting all change signals.
void viewModelChangeSignalChanged(const QString &viewModelChangeSignal)
NOTIFY accessor for MvvmBinding::viewChangeSignal.
The QML import for the QtMvvmCore QML module.
void viewPropertyChanged(const QString &viewProperty)
NOTIFY accessor for MvvmBinding::viewProperty.
QString viewModelChangeSignal
An alternative signal to be used instead of the viewModelProperty notify signal to detect property ch...
void viewModelPropertyChanged(const QString &viewModelProperty)
NOTIFY accessor for MvvmBinding::viewModelProperty.
Q_INVOKABLE bool isValid() const
Specifies whether the binding is a valid and active binding.
void viewChangeSignalChanged(const QString &viewChangeSignal)
NOTIFY accessor for MvvmBinding::type.
QString viewProperty
The property of the view to use in the binding.
QString viewChangeSignal
An alternative signal to be used instead of the viewProperty notify signal to detect property changes...
QObject viewModel
The object in the role of a viewmodel.
void typeChanged(BindingDirection type)
NOTIFY accessor for MvvmBinding::viewModelChangeSignal.
void viewModelChanged(QObject *viewModel)
NOTIFY accessor for MvvmBinding::viewModel.
QObject view
The object in the role of a view.
The primary namespace of the QtMvvm library.
BindingDirectionFlag
Flags to control how to bind the properties.