QtMvvm  1.0.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
Public Types | Public Member Functions | List of all members
QtMvvm::Binding Class Reference

A handle to a multidirectional binding between properties. More...

#include <binding.h>

Public Types

enum  BindingDirectionFlag { SingleInit = 0x01, OneWayToView = (0x02 | SingleInit), OneWayToViewModel = 0x04, TwoWay = (OneWayToView | OneWayToViewModel) }
 Flags to control how to bind the properties. More...
 

Public Member Functions

bool isValid () const
 Specifies whether the binding is a valid and active binding. More...
 
Q_INVOKABLE void unbind ()
 Remove the binding by disconnecting all change signals.
 

Detailed Description

A handle to a multidirectional binding between properties.

This class is returned by the bind() function as a handle to a binding. It can be used to check if the binding is valid and can remove a binding again.

Note
You don't need to keep the Binding as reference. The binding will stay even if you don't hold any references to it. This class serves as a passive watcher over a binding.
See also
QtMvvm::bind

Definition at line 14 of file binding.h.

Member Enumeration Documentation

◆ BindingDirectionFlag

Flags to control how to bind the properties.

Enumerator
SingleInit 

Only initialize the view by settings it to the viewmodels value on creation.

OneWayToView 

All changes done to the viewmodel are propagated to the view.

OneWayToViewModel 

All changes done to the view are propagated to the viewmodel.

TwoWay 

All changes on both sides are propagated to the other one.

Definition at line 20 of file binding.h.

Member Function Documentation

◆ isValid()

QtMvvm::Binding::isValid ( ) const

Specifies whether the binding is a valid and active binding.

Returns
true If the binding is valid and active, false if invalid or already unbound

A binding is considered valid is if has successfully been set up and has not been unbound yet. A valid binding means view and viewModel are valid can the properties could be found.

See also
Binding::unbind, bind()

The documentation for this class was generated from the following files: