C

Screen Class

class Qul::PlatformInterface::Screen

The Screen class holds information about display size in pixels. More...

Header: #include <platforminterface/screen.h>
Since: Qt Quick Ultralite (Platform) 1.5

Public Functions

Screen(const PlatformInterface::Size &size, const Qul::PixelFormat &colorFormat, const char *identifier = "", bool resizeable = false, const PlatformInterface::Size &defaultApplicationSize = PlatformInterface::Size())
Screen()
Qul::PlatformInterface::Rgba32 backgroundColor() const
Qul::PixelFormat colorFormat() const
PlatformInterface::Size defaultApplicationSize() const
const char *identifier() const
bool isResizeable() const
void resize(const PlatformInterface::Size &size)
void setBackgroundColor(Qul::PlatformInterface::Rgba32 color)
PlatformInterface::Size size() const

Detailed Description

Member Function Documentation

[since Qt Quick Ultralite (Platform) 1.9] Screen::Screen(const PlatformInterface::Size &size, const Qul::PixelFormat &colorFormat, const char *identifier = "", bool resizeable = false, const PlatformInterface::Size &defaultApplicationSize = PlatformInterface::Size())

Constructs a Screen object with the given parameters.

Default values for resizeable and identifier are false and an empty string respectively.

If defaultApplicationSize is empty, the screen size will be used instead.

Note: The constructor is creating a shallow copy of the identifier pointer. String literal with static storage duration is expected for identifier argument.

Example usage:

const PlatformInterface::Size size(800, 480);
const char *name = "example_display"; // string literal with static storage duration
PlatformInterface::Screen screen(size, Qul::PixelFormat_RGB32, name);

Example of possible problem with local storage duration variable:

const PlatformInterface::Size size(800, 480);
const std::string badName = "example_display"; // std::string with scoped lifetime
PlatformInterface::Screen screen(size, Qul::PixelFormat_RGB32, badName.c_str()); // this will create a dangling pointer once std::string gets destroyed

This function was introduced in Qt Quick Ultralite (Platform) 1.9.

Screen::Screen()

Constructs a Screen with default parameters.

Creates a Screen object with zero width and height, invalid color format, an empty string identifier, and resizing enabled.

[since Qt Quick Ultralite (Platform) 1.7] Qul::PlatformInterface::Rgba32 Screen::backgroundColor() const

Get the background color of the screen.

For platforms with layer support, the background color specifies the color visible in the areas where there are no layers or where there are partialy transparent layers.

This function is used by the platform implementation in PlatformContext::presentFrame in order to update the background color of the screen.

This function was introduced in Qt Quick Ultralite (Platform) 1.7.

See also setBackgroundColor().

[since Qt Quick Ultralite (Platform) 1.8] Qul::PixelFormat Screen::colorFormat() const

Get the color format of the screen.

Returns information on the actual screen color/pixel format.

For platforms with layer support, this function is used by the Qul::Application class to set the default color depth of the implicit (default) item layer.

This function was introduced in Qt Quick Ultralite (Platform) 1.8.

PlatformInterface::Size Screen::defaultApplicationSize() const

Returns the default application size.

const char *Screen::identifier() const

Returns unique screen identifier.

bool Screen::isResizeable() const

Returns true if the Screen can be resized or false otherwise.

See also resize().

void Screen::resize(const PlatformInterface::Size &size)

Resizes the Screen by overriding it's internal size value.

This function does not check for resizable flag and result of isResizeable() should be checked before calling it.

See also isResizeable().

[since Qt Quick Ultralite (Platform) 1.7] void Screen::setBackgroundColor(Qul::PlatformInterface::Rgba32 color)

Set the background color of the screen to color.

For platforms with layer support, the background color specifies the color visible in the areas where there are no layers or where there are partialy transparent layers.

This function is used by Qt Quick Ultralite core to update the screen's background color.

This function was introduced in Qt Quick Ultralite (Platform) 1.7.

See also backgroundColor().

PlatformInterface::Size Screen::size() const

Returns size of the display.

Available under certain Qt licenses.
Find out more.