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

Provides a context to register and resolve constraints. More...

#include <aqt/cassowary/Solver.hpp>

Inheritance diagram for aqt::cassowary::Solver:
aqt::cassowary::Contextual

Public Member Functions

 Solver (QQuickItem *pParent=nullptr)
 
Q_SIGNAL void debugChanged (bool debug)
 
- Public Member Functions inherited from aqt::cassowary::Contextual
 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 updatePolish () override
 
void componentComplete () override
 
std::shared_ptr< Contextprovided () override
 
void addIn (Context &) override
 
void removeIn (Context &) override
 
- Protected Member Functions inherited from aqt::cassowary::Contextual
void add ()
 
void remove ()
 
template<typename Fn >
void update (Fn &&cb)
 
template<typename Fn >
Context::Callback guarded (Fn fn)
 
void updateContext ()
 
Contextualprovider ()
 

Properties

bool debug
 Toggles debug traces for the context provided by this solver. More...
 
- Properties inherited from aqt::cassowary::Contextual
aqt::cassowary::Contextual extend
 If non-null, this contextual will use the same context as used by this contextual.
 

Detailed Description

Provides a context to register and resolve constraints.

It may as well simply extend another context, following the normal rules of Contextuals.

Note that the solver does not resolve the equations until the next redraw of the screen. This prevents intermediate values to confuse the solver during binding propagations, as well as improves performance as only the minimal set of updates to visualize new layouts is performed. If needed (e.g. in tests) one may manually update the system with the commit() method.

Example
Solver {}
Import in QML
import Aqt.Cassowary 1.0
Since
1.0
See also
Contextual

Property Documentation

bool aqt::cassowary::Solver::debug

Toggles debug traces for the context provided by this solver.

This has no effect if the solver is simply extending another context. Also:

  • The debug traces may are still affected by the general Qt logging filters.
  • Debug traces will never be shown if NDEBUG is defined at compilation time.

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