C
Qul Namespace
Provides types and declarations specific to Qt Quick Ultralite and miscellaneous functions related to application life cycle. More...
Header: | #include <qul/qul.h> |
Namespaces
namespace | Platform |
namespace | PlatformInterface |
Classes
(since Qt Quick Ultralite 1.2) class | Application |
(since Qt Quick Ultralite 2.1) class | ApplicationConfiguration |
(since Qt Quick Ultralite 2.0) class | ApplicationSettings |
(since Qt Quick Ultralite 2.9) struct | BinaryResource |
(since Qt Quick Ultralite 1.0) class | EventQueue |
(since Qt Quick Ultralite 2.12) class | Flags |
(since Qt Quick Ultralite 2.11) struct | GeoPositionInfo |
(since Qt Quick Ultralite 2.11) class | GeoPositionSource |
(since Qt Quick Ultralite 1.5) struct | Image |
(since Qt Quick Ultralite 1.5) struct | ImageProvider |
(since Qt Quick Ultralite 1.5) struct | ImageWriteGuard |
(since Qt Quick Ultralite 1.0) struct | ListModel |
(since Qt Quick Ultralite 2.9) struct | ListProperty |
(since Qt Quick Ultralite 2.10) class | MapTileFetcher |
(since Qt Quick Ultralite 1.0) class | Object |
(since Qt Quick Ultralite 1.9) class | PaintedItemDelegate |
(since Qt Quick Ultralite 1.0) struct | Property |
(since Qt Quick Ultralite 2.12) struct | ResourceStorageSectionInfo |
(since Qt Quick Ultralite 1.2) class | RootItem |
(since Qt Quick Ultralite 1.5) struct | SharedImage |
(since Qt Quick Ultralite 1.0) struct | Signal |
(since Qt Quick Ultralite 1.0) struct | Singleton |
(since Qt Quick Ultralite 2.10) class | Status |
(since Qt Quick Ultralite 1.0) class | Timer |
Types
enum | EventQueueOverrunPolicy { EventQueueOverrunPolicy_Discard, EventQueueOverrunPolicy_OverwriteOldest } |
(since Qt Quick Ultralite 2.12) enum class | MonotypeDataTable { decompositionData0, decompositionData1, decompositionData2, decompositionData3, decompositionIndex, …, AllDataTables } |
(since Qt Quick Ultralite 2.12) | MonotypeDataTables |
enum | PixelFormat { PixelFormat_ARGB32_Premultiplied, PixelFormat_ARGB32, PixelFormat_RGB32, PixelFormat_RGB16, PixelFormat_ARGB4444_Premultiplied, …, PixelFormat_Invalid } |
(since Qt Quick Ultralite 2.10) enum class | PlatformInitializationType { InitializePlatform, InitializePlatformAndResources } |
(since Qt Quick Ultralite 2.10) enum class | ResourceInitializationError { InvalidChecksum, InvalidResourceData, MemoryAllocationFailed, UnsupportedRawDataImageFormat, VersionTooHigh, VersionTooLow } |
(since Qt Quick Ultralite 2.12) enum class | ResourceInitializationOptions { DisableAutomaticVersionChecking, AllowUnlistedResources } |
qreal |
Functions
(since Qt Quick Ultralite 1.0) void | appMain(const void *arg = NULL) |
(since Qt Quick Ultralite 2.10) void | enableResourceChecksumVerification() |
(since Qt Quick Ultralite 2.2) const char * | errorCodeToString(QulError code) |
(since Qt Quick Ultralite 2.0) void | initHardware() |
(since Qt Quick Ultralite 1.0) void | initPlatform(Qul::PlatformInitializationType initializationType = PlatformInitializationType::InitializePlatformAndResources) |
(since Qt Quick Ultralite 2.10) Qul::Status<Qul::ResourceInitializationError> | initResources(Qul::Flags<Qul::ResourceInitializationOptions> options = Qul::Flags<Qul::ResourceInitializationOptions>()) |
(since Qt Quick Ultralite 2.12) bool | queryResourceStorageSectionInfo(const char *resourceStorageSectionName, Qul::ResourceStorageSectionInfo *info = NULL) |
(since Qt Quick Ultralite 2.2) QulErrorHandler * | setErrorHandler(QulErrorHandler *handler) |
(since Qt Quick Ultralite 2.12) bool | validateMonotypeDataTableChecksums(Qul::MonotypeDataTables tables = MonotypeDataTables(MonotypeDataTable::AllDataTables)) |
Classes
class Application
The Application class is used to start Qt Quick Ultralite. More...
class ApplicationConfiguration
The Application configuration class with text cache and other configurations. More...
class ApplicationSettings
The ApplicationSettings class is a container for Application
settings. More...
class BinaryResource
Interface for accessing BinaryFiles. More...
class EventQueue
Provides a convenient way to send and receive events across different parts of the application. More...
class Flags
class GeoPositionInfo
The GeoPositionInfo class provides an API to communicate position information to PositionSource QML type. More...
class GeoPositionSource
The GeoPositionSource class provides an abstract API to implement retrieving position information. More...
class Image
An image representation that allows direct access to the pixel data. More...
class ImageProvider
The ImageProvider class provides an interface for supporting image requests in QML. More...
class ImageWriteGuard
A helper for calling Image::beginWrite() and Image::endWrite(). More...
class ListModel
Inherit from this class to expose a model to QML. More...
class ListProperty
Use the ListProperty class to hold a list of a given type. More...
class MapTileFetcher
The MapTileFetcher class provides an abstract API to implement fetching of a map tile image. More...
class Object
Provides abstract implementation for all items or objects used in Qt Quick Ultralite. More...
class PaintedItemDelegate
Base class for representing painted item objects. More...
class Property
The Property class can be used to hold a property of a given type. More...
class ResourceStorageSectionInfo
class RootItem
The RootItem class is a public type used in Application::setRootItem(). More...
class SharedImage
Shared reference to image data. More...
class Signal
Allows creating a signal that can be connected from QML. More...
class Singleton
Inherit from this class to expose the C++ class or struct to the QML as a singleton. More...
class Status
class Timer
Provides a way to run repetitive and single-shot timers. More...
Type Documentation
enum Qul::EventQueueOverrunPolicy
Defines what happens when an event is posted to a EventQueue and the queue is already full.
Constant | Value | Description |
---|---|---|
Qul::EventQueueOverrunPolicy_Discard | 0 | If the queue is full, the posted event will be discarded. |
Qul::EventQueueOverrunPolicy_OverwriteOldest | 1 | If the queue is full, the posted event will overwrite the oldest existing event in the queue. The overwritten event is lost. |
[since Qt Quick Ultralite 2.12]
enum class Qul::MonotypeDataTable
Used to specify which monotype data tables to validate when calling Qul::validateMonotypeDataTableChecksums().
Constant | Value | Description |
---|---|---|
Qul::MonotypeDataTable::decompositionData0 | 1 << 0 | decompositionData0 data table |
Qul::MonotypeDataTable::decompositionData1 | 1 << 1 | decompositionData1 data table |
Qul::MonotypeDataTable::decompositionData2 | 1 << 2 | decompositionData2 data table |
Qul::MonotypeDataTable::decompositionData3 | 1 << 3 | decompositionData3 data table |
Qul::MonotypeDataTable::decompositionIndex | 1 << 4 | decompositionIndex data table |
Qul::MonotypeDataTable::msBidiIndex | 1 << 5 | msBidiIndex data table |
Qul::MonotypeDataTable::msBidiLut | 1 << 6 | msBidiLut data table |
Qul::MonotypeDataTable::msBidiProps | 1 << 7 | msBidiProps data table |
Qul::MonotypeDataTable::msMirroringOffset | 1 << 8 | msMirroringOffset data table |
Qul::MonotypeDataTable::msDLPTrieData | 1 << 9 | msDLPTrieData data table |
Qul::MonotypeDataTable::msDLPTrieIndex | 1 << 10 | msDLPTrieIndex data table |
Qul::MonotypeDataTable::msGeneralPropsArray | 1 << 11 | msGeneralPropsArray data table |
Qul::MonotypeDataTable::msGeneralPropsIndex | 1 << 12 | msGeneralPropsIndex data table |
Qul::MonotypeDataTable::msGeneralPropsLut | 1 << 13 | msGeneralPropsLut data table |
Qul::MonotypeDataTable::MsScriptRangesTable | 1 << 14 | MsScriptRangesTable data table |
Qul::MonotypeDataTable::AllDataTables | (MsScriptRangesTable << 1) - 1 | Initialize all of the data tables |
This enum was introduced in Qt Quick Ultralite 2.12.
See also Qul::validateMonotypeDataTableChecksums.
[since Qt Quick Ultralite 2.12]
Qul::MonotypeDataTables
A convenience typedef for Qul::Flags<Qul::MonotypeDataTable>
Used to specify which monotype data tables to validate when calling Qul::validateMonotypeDataTableChecksums().
This typedef was introduced in Qt Quick Ultralite 2.12.
See also Qul::validateMonotypeDataTableChecksums.
enum Qul::PixelFormat
This enum specifies the pixel format used in an area of memory.
Constant | Value | Description |
---|---|---|
Qul::PixelFormat_ARGB32_Premultiplied | 1 | 32 bits per pixel. 8 bits for each color component and 8 for alpha channel. Color values are premultiplied with alpha. |
Qul::PixelFormat_ARGB32 | 0 | 32 bits per pixel. 8 bits for each color component and alpha channel. |
Qul::PixelFormat_RGB32 | 2 | 32 bits per pixel. 8 bits for each color component. Alpha channel is assumed to be set to constant 0xff . |
Qul::PixelFormat_RGB16 | 5 | 16 bits per pixel. 5 bits for red and blue color components, 6 bits for green (565). No alpha channel. |
Qul::PixelFormat_ARGB4444_Premultiplied | 9 | 16 bits per pixel. 4 bits for each color component and 4 for alpha channel. Color values are premultiplied with alpha. |
Qul::PixelFormat_ARGB4444 | 8 | 16 bits per pixel. 4 bits for each color component and 4 for alpha channel. |
Qul::PixelFormat_RGB332 | 10 | 8 bits per pixel. 3 bits for red and green color components, 2 bits for blue. No alpha channel. |
Qul::PixelFormat_Alpha8 | 6 | 8 bits per pixel. No color component information, only alpha channel stored. |
Qul::PixelFormat_Alpha1 | 7 | 1 bit per pixel. 1 bit used only for the alpha channel. |
Qul::PixelFormat_RLE_ARGB32 | 11 | Targa RLE format with 32 bits per pixel precision. 8 bits for each color component and 8 for alpha channel. |
Qul::PixelFormat_RLE_ARGB32_Premultiplied | 12 | Targa RLE format with 32 bits per pixel precision. 8 bits for each color component and 8 for alpha channel. Color values are premultiplied with alpha. |
Qul::PixelFormat_RLE_RGB32 | 13 | Targa RLE format with 32 bits per pixel precision. Alpha channel is assumed to be set to constant 0xff . |
Qul::PixelFormat_RLE_RGB888 | 14 | Targa RLE format with 24 bits per pixel precision. 8 bits for each color component with no alpha channel. |
Qul::PixelFormat_Custom | 128 | Custom format implemented by the platform. |
Qul::PixelFormat_Invalid | 15 | Represents an invalid pixel format. |
[since Qt Quick Ultralite 2.10]
enum class Qul::PlatformInitializationType
Specify which parts to initialize when calling initPlatform().
Constant | Value | Description |
---|---|---|
Qul::PlatformInitializationType::InitializePlatform | 0 | Initialize only the platform, not resources. |
Qul::PlatformInitializationType::InitializePlatformAndResources | 1 | Initialize both platform and resources. |
This enum was introduced in Qt Quick Ultralite 2.10.
See also initPlatform and initResources.
[since Qt Quick Ultralite 2.10]
enum class Qul::ResourceInitializationError
Defines the different possible errors that might occur during resource initialization.
Constant | Value | Description |
---|---|---|
Qul::ResourceInitializationError::InvalidChecksum | 0 | The resource data checksum verification failed. Some bytes in the resource data are not consistent with the resource binary data generated on the host. See Qul::enableResourceChecksumVerification() for more information. |
Qul::ResourceInitializationError::InvalidResourceData | 1 | The resource data was invalid or corrupt. For example, the header or footer ids did not match the expected values, or the resource path hashes did not match the resources that the application was originally built with. |
Qul::ResourceInitializationError::MemoryAllocationFailed | 2 | Initialization failed due to memory allocation failure. There was not enough memory available to initialize all resource data. |
Qul::ResourceInitializationError::UnsupportedRawDataImageFormat | 3 | Image decoding failed for an image resource with MCU.resourceKeepRawData set to true. |
Qul::ResourceInitializationError::VersionTooHigh | 4 | The major version of loaded the resource data was higher than the major version of the resource data that the application was originally built with. |
Qul::ResourceInitializationError::VersionTooLow | 5 | The major or minor version of the loaded resource data was lower than the major or minor version of the resource data that the application was originally built with. |
This enum was introduced in Qt Quick Ultralite 2.10.
See also initResources.
[since Qt Quick Ultralite 2.12]
enum class Qul::ResourceInitializationOptions
Options to control the behavior of initResources().
Constant | Value | Description |
---|---|---|
Qul::ResourceInitializationOptions::DisableAutomaticVersionChecking | 1 | Disables automatic version checking. With this option initResources() will succeed instead of returning Qul::ResourceInitializationError::VersionTooLow or Qul::ResourceInitializationError::VersionTooHigh, in the case where the versions don't match. |
Qul::ResourceInitializationOptions::AllowUnlistedResources | 2 | Prevents initResources() from failing with Qul::ResourceInitializationError::InvalidResourceData if new resources have been added relative to when the application was built, or if older resource data containing resources that have later been removed from the application is used. |
This enum was introduced in Qt Quick Ultralite 2.12.
See also initResources.
qreal
Typedef for double
unless configured otherwise with QUL_QREAL_TYPE
compiler define option.
Function Documentation
[since Qt Quick Ultralite 1.0]
void Qul::appMain(const void *arg = NULL)
This function initializes and also acts as a main loop for Qt Quick Ultralite application. This function never exits. arg is not used.
Hardware and Qt Quick Ultralite platform specific components needs to be initialized before calling this function.
This function is called implicitly as part of default entry point implementation if app_target_default_entrypoint is used.
This function was introduced in Qt Quick Ultralite 1.0.
See also initHardware, initPlatform, and Running Qt Quick Ultralite in applications.
[since Qt Quick Ultralite 2.10]
void Qul::enableResourceChecksumVerification()
Enable resource data checksum verification
This function enables a resource binary checksum verification to be done during resource initialization, which happens when Qul::initPlatform() or Qul::initResources() is called. The verification computes a CRC32 checksum at runtime, and compares it to the checksum that was computed by the Qt Quick Ultralite resource compiler when the resource binary was originally generated.
If the checksum verification fails, the QulError_Qul_ResourceInitializationFailed assert with parameter ResourceInitializationError::InvalidChecksum will be triggered if Qul::initPlatform() is called with the PlatformInitializationType::InitializePlatformAndResources initialization option. If Qul::initResources() is used, it will return the error code to ResourceInitializationError::InvalidChecksum.
If the resource initialization fails, using any Qt Quick Ultralite API is not supported and may yield undefined behavior.
To have any effect, this function has to be called before Qul::initPlatform() or Qul::initResources() is called.
This function was introduced in Qt Quick Ultralite 2.10.
See also initPlatform and initResources.
[since Qt Quick Ultralite 2.2]
const char *errorCodeToString(QulError code)
Returns a pointer to C-string representation of the error code.
On debug build, the function returns a string representation for error range start values and error codes in the Core
and Platform
range. On release build, it returns a string representation for error range start values and empty string for the rest of error code values.
Note: Returns an empty string for error codes in the Custom
range.
This function was introduced in Qt Quick Ultralite 2.2.
See also Qul::PlatformInterface::error and Error handling.
[since Qt Quick Ultralite 2.0]
void Qul::initHardware()
Initialize hardware required by Qt Quick Ultralite.
This may include clocks, pins, peripherals, buses and memories.
Typically it's called just before Qul::initPlatform(), but developer may also decide not call it all and perform its own hardware initialization.
This function is called implicitly as part of default entry point implementation if app_target_default_entrypoint is used.
This function calls PlatformContext::initializeHardware.
This function was introduced in Qt Quick Ultralite 2.0.
See also appMain, initPlatform, and Running Qt Quick Ultralite in applications.
[since Qt Quick Ultralite 1.0]
void Qul::initPlatform(Qul::PlatformInitializationType initializationType = PlatformInitializationType::InitializePlatformAndResources)
Initialize Qt Quick Ultralite platform specific components.
This may include resource preloading and initializing CPU-based fallback drawing engine in Qt Quick Ultralite core.
This function is called implicitly as part of default entry point implementation if app_target_default_entrypoint is used.
This function calls PlatformContext::initializePlatform.
If initializationType is set to PlatformInitializationType::InitializePlatformAndResources, font alpha maps, binary resources image resources and resource caches are also initialized. This is the default behavior.
If initializationType is set to PlatformInitializationType::InitializePlatform, the application should explicitly call initResources() following the call to initPlatform().
This function was introduced in Qt Quick Ultralite 1.0.
See also appMain, initHardware, initResources, and Running Qt Quick Ultralite in applications.
[since Qt Quick Ultralite 2.10]
Qul::Status<Qul::ResourceInitializationError> Qul::initResources(Qul::Flags<Qul::ResourceInitializationOptions> options = Qul::Flags<Qul::ResourceInitializationOptions>())
Initialize Qt Quick Ultralite resources.
This function initializes resource font alpha maps, binary resources, image resources, and resource caches. Resource initialization has to happen once at application startup, before calling Application::exec() or Application::update().
Before using this function, Qul::initPlatform() should have been called with Qul::PlatformInitializationType::InitializePlatform.
The provided options can be used to control the initialization behavior.
The return value indicates whether initialization was successful or not.
If the resource initialization fails, using any Qt Quick Ultralite API (including this function itself) is not supported and may yield undefined behavior.
If resource initialization has already been successfully performed, then this function returns true
immediately.
This function was introduced in Qt Quick Ultralite 2.10.
See also appMain, initHardware, initPlatform, and Running Qt Quick Ultralite in applications.
[since Qt Quick Ultralite 2.12]
bool Qul::queryResourceStorageSectionInfo(const char *resourceStorageSectionName, Qul::ResourceStorageSectionInfo *info = NULL)
Queries information about the resource storage section with resourceStorageSectionName, which is mentioned in the QML project file using ImageFiles.MCU.resourceStorageSection.
Call initResources() before calling this function either directly or from initPlatform().
Returns false
if the resource storage section is not known.
If the resource storage section is known, true
is returned and info includes information about the resource storage section.
This function was introduced in Qt Quick Ultralite 2.12.
[since Qt Quick Ultralite 2.2]
QulErrorHandler *Qul::setErrorHandler(QulErrorHandler *handler)
Set error handler to handler. handler is called when error is reported with Qul::PlatformInterface::error.
Passing NULL
as argument will restore the default error handling.
Error handler example:
#include <qul/error.h> void customErrorHandler(enum QulError code, unsigned int lineNumber, int param1, int param2, int param3) { Qul::PlatformInterface::log("Error code: %u, line: %u, params: %i, %i, %i.\r\n", (unsigned int) code, lineNumber, param1, param2, param3); while (1) { }; // The error handler must not return! }
The customErrorHandler
function is set to handle the errors in the example below.
Qul::initHardware(); Qul::setErrorHandler(customErrorHandler); Qul::initPlatform(); Qul::Application app;
This function calls Qul::PlatformInterface::setErrorHandler.
Returns a pointer to the previous error handler or NULL
when the default handler is in use.
This function was introduced in Qt Quick Ultralite 2.2.
See also Error handling.
[since Qt Quick Ultralite 2.12]
bool Qul::validateMonotypeDataTableChecksums(Qul::MonotypeDataTables tables = MonotypeDataTables(MonotypeDataTable::AllDataTables))
Validates the Monotype data table checksums for the given tables.
By default, all available tables are validated.
Returns true
if all the checksums for the given tables matched, otherwise returns false
.
The checksum algorithm used is CRC-32 (IEEE 802.3), using the reflected polynomial 0xedb88320 (reflected version of 0x04c11db7).
If the data tables are kept in external flash, Qul::initHardware() or another initialization routine responsible for enabling the external flash has to run first.
This function was introduced in Qt Quick Ultralite 2.12.
See also Placing Monotype data tables in external flash and initResources.
Available under certain Qt licenses.
Find out more.