|
| | QtAdapter () |
| | ~QtAdapter () override |
| std::string_view | platform_name () const noexcept override |
| QtView & | view_for (QObject *obj) |
| | Wrap a native QObject* (typically a QWidget) as an IView owned by this adapter.
|
| void | set_text (binding::IView &v, std::string_view text) override |
| std::string | get_text (binding::IView &v) override |
| ::aria::Subscription | on_text_changed (binding::IView &v, std::function< void(std::string_view)> cb) override |
| void | set_bool (binding::IView &v, bool value) override |
| bool | get_bool (binding::IView &v) override |
| ::aria::Subscription | on_bool_changed (binding::IView &v, std::function< void(bool)> cb) override |
| void | set_int (binding::IView &v, int value) override |
| | QComboBox uses its current index, suitable for fixed option lists.
|
| int | get_int (binding::IView &v) override |
| ::aria::Subscription | on_int_changed (binding::IView &v, std::function< void(int)> cb) override |
| void | set_int64 (binding::IView &v, std::int64_t value) override |
| std::int64_t | get_int64 (binding::IView &v) override |
| ::aria::Subscription | on_int64_changed (binding::IView &v, std::function< void(std::int64_t)> cb) override |
| void | set_uint64 (binding::IView &v, std::uint64_t value) override |
| std::uint64_t | get_uint64 (binding::IView &v) override |
| ::aria::Subscription | on_uint64_changed (binding::IView &v, std::function< void(std::uint64_t)> cb) override |
| void | set_float (binding::IView &v, float value) override |
| float | get_float (binding::IView &v) override |
| ::aria::Subscription | on_float_changed (binding::IView &v, std::function< void(float)> cb) override |
| void | set_double (binding::IView &v, double value) override |
| double | get_double (binding::IView &v) override |
| ::aria::Subscription | on_double_changed (binding::IView &v, std::function< void(double)> cb) override |
| void | set_visible (binding::IView &v, bool visible) override |
| void | set_enabled (binding::IView &v, bool enabled) override |
| ::aria::Subscription | on_click (binding::IView &v, std::function< void()> cb) override |
| virtual | ~IViewAdapter () |
Qt6 implementation of IViewAdapter.
Supports out of the box:
- QLabel / QLineEdit / QPlainTextEdit / QTextEdit (text)
- QCheckBox / QRadioButton / QAbstractButton (bool)
- QSpinBox / QAbstractSlider (QSlider, QDial, QScrollBar) / QProgressBar (int)
- QComboBox (text or int currentIndex; -1 means no selection)
- QDoubleSpinBox (double)
- QPushButton / QToolButton (click)
- QWidget (visible / enabled)
Internally we own a small per-adapter signal registry so the Subscription objects returned to user code are the unified aria::Subscription used everywhere else — RAII-safe even if the QWidget gets destroyed first. Invoke adapter operations and destroy the adapter on the widgets' Qt owner thread. Returned subscriptions may be released after either owner is gone.
| QtView & aria::adapters::qt6::QtAdapter::view_for |
( |
QObject * | obj | ) |
|
|
nodiscard |
Wrap a native QObject* (typically a QWidget) as an IView owned by this adapter.
Every host used to hand-roll this: allocate a QtView, then park it in some keepalive container because BindingEngine takes IView& and does not own its views. The adapter already needs a per-object registry (see the signal bridges), so it is the right owner.
be.bind_text(vm.name, adapter->view_for(nameEdit));
Lifetime: the returned reference stays valid until the QObject is destroyed (Qt's destroyed signal drops the entry, after the IView destroy signal has fired and released every binding) or until the adapter itself is destroyed. Calling view_for twice for the same object returns the same QtView, so multiple bindings on one widget share a single per-view subscription bucket in BindingEngine.
Passing nullptr is a programming error and throws std::invalid_argument. During adapter teardown, reentrant view creation throws std::logic_error and reentrant event subscriptions return an empty Subscription.