diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-03-15 13:39:41 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-03-22 09:51:54 +0000 |
commit | 90d98e1330bd46b5defafd5d6b86fa8fe157b48d (patch) | |
tree | 722e2b1d371c6b58144d51b8167faa9d1c86e7f0 /src/quick/designer | |
parent | e32fb877ec0662dfda41ce490d77d8bf35a377f1 (diff) |
Enable building Qt Quick module with QT_NO_OPENGL defined
Currently the Qt Quick module depends on either the OpenGL or OpenGLES
headers being available at build time. Since we are adding support for
adaptations that do not depend on OpenGL, it should be possible to build
Qt Quick in environments that do not have OpenGL development headers.
This does present many challenges though because in some cases GL types,
and classes that require OpenGL are part of the public APIs. However
since these classes were never available when QT_NO_OPENGL was defined,
it should be possible to redefine the function signatures under this
scenario, since it's not possible to break binary compatibility if there
never were any binaries to break compatibility with.
One of the bigger changes that was necessary to facilitate this change
is creating interfaces out of QSGContext and QSGRenderContext. Here the
default behavior was usage of OpenGL directly, even though subclasses
could override all OpenGL usage. Making them interfaces should bring
QSGContext and QSGRenderContext more in line with the other classes
present in the adaptation layer.
Change-Id: Iaa54dc0f6cfd18d2da1d059548abf509bd71f200
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/quick/designer')
-rw-r--r-- | src/quick/designer/qquickdesignersupport.cpp | 2 | ||||
-rw-r--r-- | src/quick/designer/qquickdesignerwindowmanager.cpp | 11 | ||||
-rw-r--r-- | src/quick/designer/qquickdesignerwindowmanager_p.h | 7 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp index 5bb36c5192..ec00eed18a 100644 --- a/src/quick/designer/qquickdesignersupport.cpp +++ b/src/quick/designer/qquickdesignersupport.cpp @@ -92,6 +92,7 @@ void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool h texture->setRect(referencedItem->boundingRect()); texture->setSize(referencedItem->boundingRect().size().toSize()); texture->setRecursive(true); +#ifndef QT_NO_OPENGL #ifndef QT_OPENGL_ES if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) texture->setFormat(GL_RGBA8); @@ -100,6 +101,7 @@ void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool h #else texture->setFormat(GL_RGBA); #endif +#endif texture->setHasMipmaps(false); m_itemTextureHash.insert(referencedItem, texture); diff --git a/src/quick/designer/qquickdesignerwindowmanager.cpp b/src/quick/designer/qquickdesignerwindowmanager.cpp index efa3bcb51a..2d37db08e7 100644 --- a/src/quick/designer/qquickdesignerwindowmanager.cpp +++ b/src/quick/designer/qquickdesignerwindowmanager.cpp @@ -39,8 +39,9 @@ #include "qquickdesignerwindowmanager_p.h" #include "private/qquickwindow_p.h" -#include <QtGui/QOpenGLContext> - +#ifndef QT_NO_OPENGL +# include <QtQuick/private/qsgdefaultrendercontext_p.h> +#endif #include <QtQuick/QQuickWindow> QT_BEGIN_NAMESPACE @@ -48,7 +49,7 @@ QT_BEGIN_NAMESPACE QQuickDesignerWindowManager::QQuickDesignerWindowManager() : m_sgContext(QSGContext::createDefaultContext()) { - m_renderContext.reset(new QSGRenderContext(m_sgContext.data())); + m_renderContext.reset(m_sgContext.data()->createRenderContext()); } void QQuickDesignerWindowManager::show(QQuickWindow *window) @@ -66,6 +67,7 @@ void QQuickDesignerWindowManager::windowDestroyed(QQuickWindow *) void QQuickDesignerWindowManager::makeOpenGLContext(QQuickWindow *window) { +#ifndef QT_NO_OPENGL if (!m_openGlContext) { m_openGlContext.reset(new QOpenGLContext()); m_openGlContext->setFormat(window->requestedFormat()); @@ -76,6 +78,9 @@ void QQuickDesignerWindowManager::makeOpenGLContext(QQuickWindow *window) } else { m_openGlContext->makeCurrent(window); } +#else + Q_UNUSED(window) +#endif } void QQuickDesignerWindowManager::exposureChanged(QQuickWindow *) diff --git a/src/quick/designer/qquickdesignerwindowmanager_p.h b/src/quick/designer/qquickdesignerwindowmanager_p.h index 8af54c117f..a50f8aa49f 100644 --- a/src/quick/designer/qquickdesignerwindowmanager_p.h +++ b/src/quick/designer/qquickdesignerwindowmanager_p.h @@ -57,6 +57,10 @@ #include <private/qtquickglobal_p.h> #include <QtQuick/private/qsgcontext_p.h> +#ifndef QT_NO_OPENGL +# include <QtGui/QOpenGLContext> +#endif + QT_BEGIN_NAMESPACE @@ -64,7 +68,6 @@ class QQuickWindow; class QSGContext; class QSGRenderContext; class QAnimationDriver; -class QOpenGLContext; class QQuickDesignerWindowManager : public QSGRenderLoop { @@ -94,7 +97,9 @@ public: static void createOpenGLContext(QQuickWindow *window); private: +#ifndef QT_NO_OPENGL QScopedPointer<QOpenGLContext> m_openGlContext; +#endif QScopedPointer<QSGContext> m_sgContext; QScopedPointer<QSGRenderContext> m_renderContext; }; |