Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::adapters::qt6::QtView Class Referencefinal

Wraps any QWidget* (or QObject*) as an IView. More...

#include <qt_view.hpp>

Inheritance diagram for aria::adapters::qt6::QtView:
[legend]

Public Member Functions

 QtView (QObject *w) noexcept
 ~QtView () override
std::string_view kind () const noexcept override
QObject * object () const noexcept
template<typename T>
T * as () const noexcept
Public Member Functions inherited from aria::binding::IView
 IView ()
 IView (const IView &)=delete
IViewoperator= (const IView &)=delete
 IView (IView &&)=delete
IViewoperator= (IView &&)=delete
virtual ~IView ()
Subscription on_destroy (std::function< void()> cb) const
 Subscribe to "this view is about to be destroyed".

Additional Inherited Members

Protected Member Functions inherited from aria::binding::IView
void fire_destroy_ () noexcept
 Invoked by ~IView() to fan out the notification — this is the last-resort trigger.

Detailed Description

Wraps any QWidget* (or QObject*) as an IView.

Lifetime (L-32)

The wrapped QObject is owned by Qt's parent-child tree, not by us. We connect to QObject::destroyed and fire the IView destroy signal from there — i.e. while this subclass's state is still valid, which is what the adapter contract asks for. Relying on the ~IView fallback alone would be too late (and never happen at all for a QtView that is kept alive by a cache).

QPointer additionally keeps object() safe if the widget is destroyed before anyone notices.

Constructor & Destructor Documentation

◆ QtView()

aria::adapters::qt6::QtView::QtView ( QObject * w)
inlineexplicitnoexcept

◆ ~QtView()

aria::adapters::qt6::QtView::~QtView ( )
inlineoverride

Member Function Documentation

◆ kind()

std::string_view aria::adapters::qt6::QtView::kind ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements aria::binding::IView.

◆ object()

QObject * aria::adapters::qt6::QtView::object ( ) const
inlinenodiscardnoexcept

◆ as()

template<typename T>
T * aria::adapters::qt6::QtView::as ( ) const
inlinenodiscardnoexcept

The documentation for this class was generated from the following file:
  • modules/adapters/qt6/include/aria/adapters/qt6/qt_view.hpp