Centralize checking for OpenGL

Change-Id: Ic2212c8519f4c771ba3e3c61dd32073b93db7ed9
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Robert Loehning
2015-09-29 16:43:42 +02:00
parent 0e8a0cac47
commit a835b51407
5 changed files with 18 additions and 12 deletions

View File

@@ -30,6 +30,9 @@
#include "hostosinfo.h"
#include <QApplication>
#include <QOpenGLContext>
#ifdef Q_OS_WIN
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 /* WinXP, needed for GetNativeSystemInfo() */
@@ -81,3 +84,12 @@ void HostOsInfo::unsetOverrideFileNameCaseSensitivity()
{
m_useOverrideFileNameCaseSensitivity = false;
}
bool HostOsInfo::canCreateOpenGLContext(QString *errorMessage)
{
static const bool canCreate = QOpenGLContext().create();
if (!canCreate)
*errorMessage = QApplication::translate("Utils::HostOsInfo",
"Cannot create OpenGL context.");
return canCreate;
}