diff --git a/docs/api/mkdocs/docs/getting-started/data-binding.md b/docs/api/mkdocs/docs/getting-started/data-binding.md index f501cc2..f53b36d 100644 --- a/docs/api/mkdocs/docs/getting-started/data-binding.md +++ b/docs/api/mkdocs/docs/getting-started/data-binding.md @@ -4,12 +4,12 @@ That means that if a value depends on another, it will automatically be updated whenever the input value changes. ## Basic Data Binding in KDBindings -The basis for Data Binding in KDBindings is formed by [Properties](properties.md). +The basis for Data Binding in KDBindings is formed by [Properties](@ref KDBindings::Property). They can be combined using arithmetic operators or just plain functions, to create new properties that are bound to the input properties. This means the result of the calculation will be updated automatically every time the input of the calculation changes. -To create a binding, use the free [makeBoundProperty](../namespaceKDBindings.md#function-makeboundproperty) function in the KDBindings namespace. +To create a binding, use the free KDBindings::makeBoundProperty function. ### Example ``` cpp @@ -26,11 +26,11 @@ width = 5; std::cout << area << std::endl; // will print 15 ``` -Pretty much all arithmetic operators are supported, as well as combinations of Properties with constant values. +Pretty much all arithmetic operators are supported, as well as combinations of properties with constant values. ## Declaring functions for use in data binding KDBindings also allows you to declare arbitrary functions as usable in the context of data binding. -See the [`node_functions.h`](../node__functions_8h.md) file for documentation on the associated macros. +See the [`node_functions.h`](./node__functions_8h.html) file for documentation on the associated macros. This is already done for some of the `std` arithmetic functions, like abs and floor. You can use the KDBINDINGS_DECLARE_STD_FUNCTION macro to declare more of these when necessary. @@ -48,7 +48,7 @@ Property positiveValue = makeBoundProperty(abs(value)); ## Binding arbitrary functions -[makeBoundProperty](../namespaceKDBindings.md#function-makeboundproperty) also accepts functions as binding, so arbitrary code can be executed to produce the new property value. +KDBindings::makeBoundProperty also accepts functions as binding, so arbitrary code can be executed to produce the new property value. ### Example ``` cpp @@ -92,13 +92,13 @@ Property result = makeBoundProperty(2 * value); result = 5; // this will throw a KDBindings::ReadOnlyProperty error! ``` -To intentionally remove a binding from a property, use its [`reset`](../../classKDBindings_1_1Property/#function-reset) function. +To intentionally remove a binding from a property, use its [`reset`](/ref KDBindings::Property::reset) function. ### Reassigning a Binding Even though KDBindings prevents you from accidentally overriding a binding with a concrete value, assigning a new binding to a Property with an existing binding is possible. -For this, use the [makeBinding](../namespaceKDBindings.md#function-makebinding) function instead of [makeBoundProperty](../namespaceKDBindings.md#function-makeboundproperty) to create the binding. +For this, use the KDBindings::makeBinding function instead of KDBindings::makeBoundProperty to create the binding. It is also possible to use makeBoundProperty, which will move-assign a new Property into the existing one, therefore completely replacing the existing Property with a new one. This means that all signals of the old property will be disconnected (see [signals & slots](signals-slots.md)) and any existing data bindings that depended on the property will be removed, which might not be what you want! @@ -126,18 +126,18 @@ result = makeBoundProperty(4 * value); // This works too, but will override all ## Deferred evaluation KDBindings optionally offers data bindings with controlled, deferred evaluation. -This feature is enabled by passing a [KDBindings::BindingEvaluator](../classKDBindings_1_1BindingEvaluator.md) to makeBoundProperty. -The binding will then only be evaluated when [`evaluateAll()`](../classKDBindings_1_1BindingEvaluator.md#function-evaluateall) is called on the evaluator instance. +This feature is enabled by passing a KDBindings::BindingEvaluator to makeBoundProperty. +The binding will then only be evaluated when [`evaluateAll()`](@ref KDbindings::BindingEvaluator::evaluateAll) is called on the evaluator instance. Deferred evaluation is useful to avoid unnecessary reevaluation of a binding, as well as controlling the frequency of binding evaluation. Especially in UI applications, only updating the displayed values once per second can help in making them readable, compared to a bunch of values updating at 60Hz. -See the [06-lazy-property-bindings](../06-lazy-property-bindings_2main_8cpp-example.md) example for more details on how to use deferred evaluation. +See the [06-lazy-property-bindings](./06-lazy-property-bindings_2main_8cpp-example.html) example for more details on how to use deferred evaluation. ## Further reading -Classes involved in data binding are [KDBindings::Property](../classKDBindings_1_1Property.md), [KDBindings::Binding](../classKDBindings_1_1Binding.md), and [KDBindings::BindingEvaluator](../classKDBindings_1_1BindingEvaluator.md). +Classes involved in data binding are KDBindings::Property, KDBindings::Binding, and KDBindings::BindingEvaluator. -See [KDBindings::makeBoundProperty](../namespaceKDBindings.md#function-makeboundproperty) for the different ways to create a binding. +See KDBindings::makeBoundProperty for the different ways to create a binding. We also recommend you take a look at our [examples](../examples.md). diff --git a/docs/api/mkdocs/docs/getting-started/index.md b/docs/api/mkdocs/docs/getting-started/index.md index 5204767..6da11b5 100644 --- a/docs/api/mkdocs/docs/getting-started/index.md +++ b/docs/api/mkdocs/docs/getting-started/index.md @@ -46,7 +46,7 @@ set(CMAKE_CXX_STANDARD 17) ### Including KDBindings Once the library is correctly added to your project, the different features of KDBindings are available for include under the `kdbindings` directory. -All parts of KDBindings are then accessible in the [KDBindings namespace](../namespaceKDBindings.md). +All parts of KDBindings are then accessible in the KDBindings namespace. ``` cpp // Example includes #include @@ -59,7 +59,7 @@ using namespace KDBindings; Signal myOtherSignal; ``` -For the list of files that can be included, see [the files page](../Files.md). +For the list of files that can be included, see [the files page](./files.html). ## KDBindings Features diff --git a/docs/api/mkdocs/docs/getting-started/properties.md b/docs/api/mkdocs/docs/getting-started/properties.md index 88f2e01..16cca1a 100644 --- a/docs/api/mkdocs/docs/getting-started/properties.md +++ b/docs/api/mkdocs/docs/getting-started/properties.md @@ -7,7 +7,7 @@ Unlike [Qts Properties](https://doc.qt.io/qt-5/properties.html), KDBindings Prop They can even be used outside of classes as free values. ## Declaring Properties -Properties can be declared for most types by creating a [KDBindings::Property](../classKDBindings_1_1Property.md) instance. +Properties can be declared for most types by creating a `KDBindings::Property` instance. The property instance will then emit [signals](signals-slots.md) every time the properties value changes, the property is moved or destructed. @@ -29,4 +29,4 @@ Expected output: Hello World! ``` -For more information and examples see the [KDBindings::Property documentation](../classKDBindings_1_1Property.md). +For more information and examples see the KDBindings::Property documentation. diff --git a/docs/api/mkdocs/docs/getting-started/signals-slots.md b/docs/api/mkdocs/docs/getting-started/signals-slots.md index 33dba7d..3bfcfda 100644 --- a/docs/api/mkdocs/docs/getting-started/signals-slots.md +++ b/docs/api/mkdocs/docs/getting-started/signals-slots.md @@ -40,7 +40,7 @@ Expected output: Hello World! ``` -For the full class reference, see: [KDBindings::Signal](../classKDBindings_1_1Signal.md). +For the full class reference, see: KDBindings::Signal. ## KDBindings Slots In KDBindings, a slot is anything that can be invoked, so any function, lambda or other object that implements the `operator()`. @@ -78,15 +78,15 @@ KDBindings expects the member function first, and the pointer to the class objec See the examples: -- [02-signal-member](../02-signal-member_2main_8cpp-example.md) -- [03-member-arguments](../03-member-arguments_2main_8cpp-example.md) -- [07-advanced connections](../07-advanced-connections_2main_8cpp-example.md) +- [02-signal-member](./02-signal-member_2main_8cpp-example.html) +- [03-member-arguments](./03-member-arguments_2main_8cpp-example.html) +- [07-advanced connections](./07-advanced-connections_2main_8cpp-example.html) -Also see the [documentation of the connect function](../classKDBindings_1_1Signal.md#function-connect). +Also see the documentation of the [connect](@ref KDBindings::Signal::connect) function. ## Managing a connection -Calling the connect function of a Signal returns a [KDBindings::ConnectionHandle](../classKDBindings_1_1ConnectionHandle.md). +Calling the connect function of a Signal returns a KDBindings::ConnectionHandle. These objects reference the connection and can be used to disconnect or temporarily block it. It's important to note that, unlike Qt, KDBindings requires you to manually disconnect a connection when any of the bound arguments are destroyed. @@ -94,7 +94,7 @@ For that purpose it's important to keep the ConnectionHandle around! You must use it to disconnect the connection, should the object that contains the slot go out of scope! Otherwise, you will encounter a dangling pointer whenever the Signal is emitted. -For further information, see the [KDBindings::ConnectionHandle](../classKDBindings_1_1ConnectionHandle.md) documentation. +For further information, see the KDBindings::ConnectionHandle documentation. ## Some Notes on Mutability and const Best Practices