Screen Class

class Qul::PlatformInterface::Screen

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

Header: #include <platforminterface/screen.h>
Since: Qt 1.5

This class was introduced in Qt 1.5.

Public Functions

Screen(const PlatformInterface::Size &size, const char *identifier = "", bool resizeable = false)
const char *identifier() const
bool isResizeable() const
void resize(const PlatformInterface::Size &size)
PlatformInterface::Size size() const

Detailed Description

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


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.

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().

PlatformInterface::Size Screen::size() const

Returns size of the display.

Available under certain Qt licenses.
Find out more.