| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Graphics.QML.Engine
Contents
Description
Functions for starting QML engines, displaying content in a window.
- data EngineConfig = EngineConfig {}
- defaultEngineConfig :: EngineConfig
- data Engine
- runEngine :: EngineConfig -> RunQML ()
- runEngineWith :: EngineConfig -> (Engine -> RunQML a) -> RunQML a
- runEngineAsync :: EngineConfig -> RunQML Engine
- runEngineLoop :: EngineConfig -> IO ()
- data RunQML a
- runEventLoop :: RunQML a -> IO a
- requireEventLoop :: RunQML a -> IO a
- data EventLoopException
- data DocumentPath
- fileDocument :: FilePath -> DocumentPath
- uriDocument :: String -> DocumentPath
Engines
data EngineConfig
Holds parameters for configuring a QML runtime engine.
Constructors
| EngineConfig | |
| Fields 
 | |
defaultEngineConfig :: EngineConfig
Default engine configuration. Loads "main.qml" from the current
 working directory into a visible window with no context object.
data Engine
Represents a QML engine.
runEngine :: EngineConfig -> RunQML ()
Starts a new QML engine using the supplied configuration and blocks until the engine has terminated.
runEngineWith :: EngineConfig -> (Engine -> RunQML a) -> RunQML a
Starts a new QML engine using the supplied configuration. The 'with' function is executed once the engine has been started and after it returns this function blocks until the engine has terminated.
runEngineAsync :: EngineConfig -> RunQML Engine
Starts a new QML engine using the supplied configuration and returns immediately without blocking.
runEngineLoop :: EngineConfig -> IO ()
Conveniance function that both runs the event loop and starts a new QML engine. It blocks keeping the event loop running until the engine has terminated.
Event Loop
data RunQML a
Wrapper around the IO monad for running actions which depend on the Qt event loop.
runEventLoop :: RunQML a -> IO a
This function enters the Qt event loop and executes the supplied function
 in the RunQML monad on a new unbound thread. The event loop will continue
 to run until all functions in the RunQML monad have completed. This
 includes both the RunQML function launched by this call and any launched
 asynchronously via requireEventLoop. When the event loop exits, all
 engines will be terminated.
It's recommended that applications run the event loop on their primordial
 thread as some platforms mandate this. Once the event loop has finished, it
 can be started again, but only on the same operating system thread as
 before. If the event loop fails to start then an EventLoopException will
 be thrown.
requireEventLoop :: RunQML a -> IO a
Executes a function in the RunQML monad asynchronously to the event
 loop. Callers must apply their own sychronisation to ensure that the event
 loop is currently running when this function is called, otherwise an
 EventLoopException will be thrown. The event loop will not exit until the
 supplied function has completed.
data EventLoopException
Exception type used to report errors pertaining to the event loop.
Document Paths
data DocumentPath
Path to a QML document file.
fileDocument :: FilePath -> DocumentPath
Converts a local file path into a DocumentPath.
uriDocument :: String -> DocumentPath
Converts a URI string into a DocumentPath.