Foundations
QML+ for Widgets
Property bindings, anchors, and named states for QWidget, without a QML engine.
Bind properties
bind() keeps a widget property in sync with a source property; it updates whenever the source's notify signal fires. Keep the returned BindingHandle if you need to pause, resume, or remove the binding.
auto* slider = new fluent::basicinput::Slider(Qt::Horizontal, this);
slider->setRange(0, 100);
auto* bar = new fluent::status_info::ProgressBar(this);
bar->setRange(0, 100);
bar->bind("value", slider, "value");import fluentqt
from PySide6.QtCore import Qt
slider = fluentqt.Slider(Qt.Horizontal, panel)
slider.setRange(0, 100)
bar = fluentqt.ProgressBar(panel)
bar.setRange(0, 100)
fluentqt.bind(slider, "value", bar, "value")Anchors and states
In C++, anchors() returns the widget's AnchorLayout::Anchors: place an edge or center line relative to the parent or a sibling, with an offset. addState() and addTransition() switch groups of properties with an animation. In Python, describe anchors with fluentqt.anchors() and add the widget to an AnchorLayout; StateGroup provides the states.
#include <FluentQt/Foundation.h>
// badge is a child of card
using Edge = fluent::AnchorLayout::Edge;
badge->anchors()->top = {card, Edge::Top, 12};
badge->anchors()->right = {card, Edge::Right, -12};import fluentqt
layout = fluentqt.AnchorLayout(card)
layout.addWidget(badge, fluentqt.anchors(top_right=(card, 12)))