libqmlbind
A C library for creating QML bindings for other languages easily through exporting objects to QML
Files | Classes | Functions
qmlbind_application

manages the GUI application's control flow and main settings. More...

Files

file  application.h
 Contains all methods defined on qmlbind_application.
 

Classes

struct  qmlbind_application
 an opaque struct to be used as self argument in the methods defined in qmlbind_application. More...
 

Functions

QMLBIND_API qmlbind_applicationqmlbind_application_new (int argc, const char *const *argv)
 Initializes the window system and constructs an application object with argc command line arguments in argv. More...
 
QMLBIND_API qmlbind_applicationqmlbind_application_instance (void)
 Returns a pointer to the application's QApplication instance. More...
 
QMLBIND_API void qmlbind_application_release (qmlbind_application *self)
 Cleans up any window system resources that were allocated by this application. More...
 
QMLBIND_API int qmlbind_application_exec (qmlbind_application *self)
 Enters the main event loop and waits until qmlbind_application_exit() is called, then returns the value that was set to qmlbind_application_exit(). More...
 
QMLBIND_API void qmlbind_application_exit (int returnCode)
 Tells the application to exit with a return code after the current event is processed. More...
 
QMLBIND_API void qmlbind_process_events ()
 Processes all pending events for the calling thread until there are no more events to process. More...
 
QMLBIND_API void qmlbind_next_tick (void(*callback)(void *), void *data)
 Adds callback as to an event queue and returns immediately. More...
 

Detailed Description

manages the GUI application's control flow and main settings.

libqmlbind's equivalent of QApplication.

Function Documentation

QMLBIND_API qmlbind_application* qmlbind_application_new ( int  argc,
const char *const *  argv 
)

Initializes the window system and constructs an application object with argc command line arguments in argv.

Does not take ownership of the passed argv. Only one application object should be created.

libqmlbind's equivalent of QApplication::QApplication.

QMLBIND_API qmlbind_application* qmlbind_application_instance ( void  )

Returns a pointer to the application's QApplication instance.

If no instance has been allocated, null is returned.

Does not transer ownership of the qmlbind_application to the caller.

libqmlbind's equivalent of QApplication's qApp macro.

QMLBIND_API void qmlbind_application_release ( qmlbind_application self)

Cleans up any window system resources that were allocated by this application.

Sets the global variable qApp to 0. libqmlbind's equivalent of QApplication::~QApplication.

QMLBIND_API int qmlbind_application_exec ( qmlbind_application self)

Enters the main event loop and waits until qmlbind_application_exit() is called, then returns the value that was set to qmlbind_application_exit().

libqmlbind's equivalent of QApplication::exec().

QMLBIND_API void qmlbind_application_exit ( int  returnCode)

Tells the application to exit with a return code after the current event is processed.

After this function has been called, the application leaves the main event loop and returns from the call to qmlbind_application_exec(). The qmlbind_applicaton_exec() function returns returnCode. If the event loop is not running, this function does nothing.

Note that unlike the C library function of the same name, this function does return to the caller – it is event processing that stops.

By convention, a returnCode of 0 means success, and any non-zero value indicates an error.

libqmlbind's equivalent of QCoreApplication::exit()

QMLBIND_API void qmlbind_process_events ( )

Processes all pending events for the calling thread until there are no more events to process.

You can call this function occasionally when your program is busy performing a long operation (e.g. copying a file). This also cleans up deferred deletes.

libqmlbind's equivalent of QCoreApplication::processEvents() and QCoreApplication::sendPostedEvents() for processing deferred deletes.

QMLBIND_API void qmlbind_next_tick ( void(*)(void *)  callback,
void *  data 
)

Adds callback as to an event queue and returns immediately.

This takes ownership from data and transfers it to callback later. Therefore, data has to be created on the heap and freed by callback at the end of the function.

Enqueuing is done via QCoreApplication::postEvent().