morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::qt_quick::Frontend Class Referencefinal

Runs a morph application in a Qt Quick window, on the calling thread. More...

#include <frontend.hpp>

Inheritance diagram for morph::qt_quick::Frontend:
morph::ui::Frontend

Public Member Functions

 Frontend (int &argc, char **argv, FrontendConfig config)
 A frontend that runs with the process's command line.
std::string_view name () const override
 The name --ui= and MORPH_UI select this frontend by.
int run (ui::AppSource &source) override
 Runs the application the source opens until it quits or its window closes.
Public Member Functions inherited from morph::ui::Frontend
 Frontend (Frontend const &)=delete
Frontend & operator= (Frontend const &)=delete
 Frontend (Frontend &&)=delete
Frontend & operator= (Frontend &&)=delete

Detailed Description

Runs a morph application in a Qt Quick window, on the calling thread.

run makes, in this order, the QGuiApplication (unless the process has one already), a qt::QtExecutor (the reactive runtime's owner and every bridge handler's callback executor), the runtime, a QtScheduler, the QML engine, the window and the backend, then runs the source through ui::runApp: it opens the source, mounts the shell through FrontendConfig::mountShell when the source is ready, and runs the event loop until AppContext::quit() or the window closes. Teardown is the reverse: the screens, then the source's connections, then the runtime, then Qt. The style is Qt Quick Controls' Basic; on the offscreen platform the window renders in software.

Definition at line 80 of file frontend.hpp.

Constructor & Destructor Documentation

◆ Frontend()

morph::qt_quick::Frontend::Frontend ( int & argc,
char ** argv,
FrontendConfig config )

A frontend that runs with the process's command line.

Parameters
argcThe argument count; QGuiApplication keeps a reference to it.
argvThe arguments.
configThe shell factory, the components and the window title.

Member Function Documentation

◆ name()

std::string_view morph::qt_quick::Frontend::name ( ) const
nodiscardoverridevirtual

The name --ui= and MORPH_UI select this frontend by.

Returns
"qt".

Implements morph::ui::Frontend.

◆ run()

int morph::qt_quick::Frontend::run ( ui::AppSource & source)
overridevirtual

Runs the application the source opens until it quits or its window closes.

Parameters
sourceOpened once the runtime exists, and closed before it is destroyed.
Returns
The exit code given to AppContext::quit(); 0 when the window was closed.
Exceptions
std::invalid_argumentwhen FrontendConfig::mountShell is empty; whatever the source or the shell factory throws.

Implements morph::ui::Frontend.


The documentation for this class was generated from the following file: