Fluent-Qt

Foundations

Forms and validation

Track field state and handle asynchronous validation without stale results.

Add fields

Put each input in a layout::Field and add it with FormController::addField(). The controller borrows the field, tracks whether it is dirty, touched, validating, or valid, and shows that state on the field. Values and validation rules stay in your code. Call markFieldChanged() for every value change, including changes made in code.

#include <FluentQt/Foundation.h>
#include <FluentQt/Layout.h>

auto* form = new fluent::FormController(this);
form->addField("email", emailField);  // emailField: fluent::layout::Field*
QObject::connect(emailEdit, &QLineEdit::textChanged, form, [form] {
    form->markFieldChanged("email");
});

Asynchronous validation

When validationRequested(key, token) arrives, run the check and pass the same token to completeValidation(key, token, valid, message). If the field is edited or reset before the check finishes, the old token is ignored.

API reference