Aqt.Cassowary
Public Member Functions | Protected Member Functions | Properties | List of all members
aqt::cassowary::Contextual Class Referenceabstract

Base class for items that need to be registered in a solver. More...

#include <aqt/cassowary/Contextual.hpp>

Inheritance diagram for aqt::cassowary::Contextual:
aqt::cassowary::ConstraintBase aqt::cassowary::Solver aqt::cassowary::Variable aqt::cassowary::Constraint aqt::cassowary::Targeted aqt::cassowary::Edit aqt::cassowary::Stay

Public Member Functions

 Contextual (QQuickItem *pParent=nullptr)
 
std::shared_ptr< Contextcontext ()
 
std::shared_ptr< const Contextcontext () const
 
Q_SIGNAL void contextChanged ()
 
Q_SIGNAL void extendChanged (aqt::cassowary::Contextual *extend)
 
Q_INVOKABLE void commit ()
 Applies all the changes associated to the context used by this contextual. More...
 
Q_INVOKABLE void defer (QJSValue cb)
 Executes the callback cb at the end of the next phase of updates in the solver, but before the changes are propagated to the bindings.
 
void defer (Context::Callback cb)
 
void defer_ (Context::Callback cb)
 
template<typename... Args>
void log (Args &&...args)
 Used to log a debug trace, that may be visible when the current context's debug property is set. More...
 

Protected Member Functions

void add ()
 
void remove ()
 
template<typename Fn >
void update (Fn &&cb)
 
template<typename Fn >
Context::Callback guarded (Fn fn)
 
void updateContext ()
 
Contextualprovider ()
 
virtual std::shared_ptr< Contextprovided ()
 
virtual void addIn (Context &impl)=0
 
virtual void removeIn (Context &impl)=0
 

Properties

aqt::cassowary::Contextual extend
 If non-null, this contextual will use the same context as used by this contextual.
 

Detailed Description

Base class for items that need to be registered in a solver.

Most Aqt.Cassowary entities need to be registered in a solver to be effective. This solver is sometimes referred to as the context. The context in which an item will be determined:

The second rule allows to conveniently define constraints directly in a context, and the previous allows for composition.

Example
Solver {
id: solver
Variable { id: something }
Constraint { expr: eq(something, 42) }
Repeater {
model: 4
Solver {
extend: solver
Variable { id: other }
Constraint { expr: geq(other, something) }
}
}
}
Import in QML
import Aqt.Cassowary 1.0
Since
1.0
See also
Contextual

Member Function Documentation

Q_INVOKABLE void aqt::cassowary::Contextual::commit ( )

Applies all the changes associated to the context used by this contextual.

See also
Solver for more details on how and when are the changes usually applied.
template<typename... Args>
void aqt::cassowary::Contextual::log ( Args &&...  args)
inline

Used to log a debug trace, that may be visible when the current context's debug property is set.

Spaces will be printed between the arguments. Arguments should be compatible with std::ostream.

See also
Solver for more details on when debug output is visible.

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