QX11Info Class

Provides information about the X display configuration. More...

Header: #include <QX11Info>
qmake: QT += x11extras
Since: Qt 5.1

Static Public Members

int appDpiX(int screen = -1)
int appDpiY(int screen = -1)
unsigned long appRootWindow(int screen = -1)
int appScreen()
unsigned long appTime()
unsigned long appUserTime()
xcb_connection_t * connection()
Display * display()
unsigned long getTimestamp()
bool isPlatformX11()
void setAppTime(unsigned long time)
void setAppUserTime(unsigned long time)

Detailed Description

Provides information about the X display configuration.

The class provides two APIs: a set of non-static functions that provide information about a specific widget or pixmap, and a set of static functions that provide the default information for the application.

Warning: This class is only available on X11. For querying per-screen information in a portable way, use QDesktopWidget.

Member Function Documentation

int QX11Info::appDpiX(int screen = -1) [static]

Returns the horizontal resolution of the given screen in terms of the number of dots per inch.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also appDpiY().

int QX11Info::appDpiY(int screen = -1) [static]

Returns the vertical resolution of the given screen in terms of the number of dots per inch.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also appDpiX().

unsigned long QX11Info::appRootWindow(int screen = -1) [static]

Returns a handle for the applications root window on the given screen.

The screen argument is an X screen number. Be aware that if the user's system uses Xinerama (as opposed to traditional X11 multiscreen), there is only one X screen. Use QDesktopWidget to query for information about Xinerama screens.

See also QApplication::desktop().

int QX11Info::appScreen() [static]

Returns the number of the screen where the application is being displayed.

This method refers to screens in the original X11 meaning with a different DISPLAY environment variable per screen. This information is only useful if your application needs to know on which X screen it is running.

In a typical multi-head configuration, multiple physical monitors are combined in one X11 screen. This means this method returns the same number for each of the physical monitors. In such a setup you are interested in the monitor information as provided by the X11 RandR extension. This is available through QDesktopWidget and QScreen.

See also display().

unsigned long QX11Info::appTime() [static]

Returns the X11 time.

See also setAppTime() and appUserTime().

unsigned long QX11Info::appUserTime() [static]

Returns the X11 user time.

See also setAppUserTime() and appTime().

xcb_connection_t * QX11Info::connection() [static]

Returns the default XCB connection for the application.

See also display().

Display * QX11Info::display() [static]

Returns the default display for the application.

See also appScreen().

unsigned long QX11Info::getTimestamp() [static]

Fetches the current X11 time stamp from the X Server.

This method creates a property notify event and blocks till it is received back from the X Server.

This function was introduced in Qt 5.2.

bool QX11Info::isPlatformX11() [static]

Returns true if the application is currently running on X11.

This function was introduced in Qt 5.2.

void QX11Info::setAppTime(unsigned long time) [static]

Sets the X11 time to the value specified by time.

See also appTime() and setAppUserTime().

void QX11Info::setAppUserTime(unsigned long time) [static]

Sets the X11 user time as specified by time.

See also appUserTime() and setAppTime().