C
Screen Class
class Qul::PlatformInterface::ScreenThe Screen class holds information about display size in pixels. More...
Header: | #include <platforminterface/screen.h> |
Since: | Qt Quick Ultralite (Platform) 1.5 |
This class was introduced in Qt Quick Ultralite (Platform) 1.5.
Public Functions
Screen(const PlatformInterface::Size &size, const char *identifier = "", bool resizeable = false) | |
Screen() | |
Qul::PlatformInterface::Rgba32 | backgroundColor() const |
const char * | identifier() const |
bool | isResizeable() const |
void | resize(const PlatformInterface::Size &size) |
void | setBackgroundColor(Qul::PlatformInterface::Rgba32 color) |
PlatformInterface::Size | size() const |
Member Function Documentation
Screen::Screen(const PlatformInterface::Size &size, const char *identifier = "", bool resizeable = false)
Constructs a Screen object with the given display size, identifier and sets if the display is resizeable.
Default values for resizeable is false
and for identifier is an empty string.
Note: The constructor is creating a shallow copy of the identifier pointer. String literal with static storage duration is expected for identifier argument.
Example of the correct usage:
const PlatformInterface::Size size(800, 480); const char* name = "example_display"; // string literal with static strorage duration PlatformInterface::Screen screen(size, 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, badName.c_str()); // this will create a dangling pointer once std::string gets destroyed
Screen::Screen()
Constructs a Screen with default parameters.
Creates a Screen object with width and height set to zero, identifier set to empty string and enable resizing of it.
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 Qul::Platform::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().
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().
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.