HostOsInfo/FileUtils/PersistentSettings: Fix build without QtGui

Interesting for command line tools that want to pull this in but not
QtGui (e.g. sdktool)

Change-Id: Ic2f5c1f3126869cc38bf672345750d7d966560fd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Eike Ziller
2017-08-18 14:32:39 +02:00
committed by hjk
parent 19cbd1ac48
commit 51e8a1730a
5 changed files with 48 additions and 12 deletions

View File

@@ -25,8 +25,11 @@
#include "hostosinfo.h"
#include <QApplication>
#include <QCoreApplication>
#if !defined(QT_NO_OPENGL) && defined(QT_GUI_LIB)
#include <QOpenGLContext>
#endif
#ifdef Q_OS_WIN
#undef _WIN32_WINNT
@@ -82,14 +85,14 @@ void HostOsInfo::unsetOverrideFileNameCaseSensitivity()
bool HostOsInfo::canCreateOpenGLContext(QString *errorMessage)
{
#ifdef QT_NO_OPENGL
#if defined(QT_NO_OPENGL) || !defined(QT_GUI_LIB)
Q_UNUSED(errorMessage)
return false;
#else
static const bool canCreate = QOpenGLContext().create();
if (!canCreate)
*errorMessage = QApplication::translate("Utils::HostOsInfo",
"Cannot create OpenGL context.");
*errorMessage = QCoreApplication::translate("Utils::HostOsInfo",
"Cannot create OpenGL context.");
return canCreate;
#endif
}