From 8aaf6a3070b2ff1cab1fa79a79fb16e2768e1e53 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 8 Sep 2013 11:43:23 +0100 Subject: Add a method to let users determine if the current platform is X11. In order to know if the methods in QtX11Extras are usable the user should have a way to tell if they're running on X11. Change-Id: I096267eb1f1fe07ee11811574a96100389c33b7d Reviewed-by: Thiago Macieira --- src/x11extras/qx11info_x11.cpp | 10 ++++++++++ src/x11extras/qx11info_x11.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src/x11extras') diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp index 713e76c..85aa9e1 100644 --- a/src/x11extras/qx11info_x11.cpp +++ b/src/x11extras/qx11info_x11.cpp @@ -82,6 +82,16 @@ QX11Info::QX11Info() { } +/*! + Returns true if the application is currently running on X11. + + \since 5.2 + */ +bool QX11Info::isPlatformX11() +{ + return QGuiApplication::platformName() == QLatin1String("xcb"); +} + /*! Returns the horizontal resolution of the given \a screen in terms of the number of dots per inch. diff --git a/src/x11extras/qx11info_x11.h b/src/x11extras/qx11info_x11.h index bbc7ff4..d5d00f3 100644 --- a/src/x11extras/qx11info_x11.h +++ b/src/x11extras/qx11info_x11.h @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE class Q_X11EXTRAS_EXPORT QX11Info { public: + static bool isPlatformX11(); + static int appDpiX(int screen=-1); static int appDpiY(int screen=-1); -- cgit v1.2.1