Fix no-opengl build

Change-Id: I577bd5d10e52571c95c9e646327264cf95ac6eb1
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Laszlo Agocs 2014-08-29 17:57:49 +02:00
parent ffceaf6213
commit 6ae01c72e1
6 changed files with 28 additions and 1 deletions

View File

@ -42,6 +42,10 @@
#ifndef QOPENGLWINDOW_H #ifndef QOPENGLWINDOW_H
#define QOPENGLWINDOW_H #define QOPENGLWINDOW_H
#include <QtCore/qglobal.h>
#ifndef QT_NO_OPENGL
#include <QtGui/QPaintDeviceWindow> #include <QtGui/QPaintDeviceWindow>
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#include <QtGui/QImage> #include <QtGui/QImage>
@ -97,4 +101,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_OPENGL
#endif #endif

View File

@ -35,7 +35,7 @@ contains(QT_CONFIG, directfb) {
SUBDIRS += directfb SUBDIRS += directfb
} }
contains(QT_CONFIG, kms) { contains(QT_CONFIG, kms):contains(QT_CONFIG, opengl) {
SUBDIRS += kms SUBDIRS += kms
} }

View File

@ -42,6 +42,10 @@
#ifndef QOPENGLWIDGET_H #ifndef QOPENGLWIDGET_H
#define QOPENGLWIDGET_H #define QOPENGLWIDGET_H
#include <QtCore/qglobal.h>
#ifndef QT_NO_OPENGL
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QtGui/QSurfaceFormat> #include <QtGui/QSurfaceFormat>
#include <QtGui/qopengl.h> #include <QtGui/qopengl.h>
@ -97,4 +101,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_OPENGL
#endif // QOPENGLWIDGET_H #endif // QOPENGLWIDGET_H

View File

@ -5486,22 +5486,30 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
//paint the background //paint the background
if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground)) if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground))
&& !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) { && !q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) {
#ifndef QT_NO_OPENGL
beginBackingStorePainting(); beginBackingStorePainting();
#endif
QPainter p(q); QPainter p(q);
paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0); paintBackground(&p, toBePainted, (asRoot || onScreen) ? flags | DrawAsRoot : 0);
#ifndef QT_NO_OPENGL
endBackingStorePainting(); endBackingStorePainting();
#endif
} }
if (!sharedPainter) if (!sharedPainter)
setSystemClip(pdev, toBePainted.translated(offset)); setSystemClip(pdev, toBePainted.translated(offset));
if (!onScreen && !asRoot && !isOpaque && q->testAttribute(Qt::WA_TintedBackground)) { if (!onScreen && !asRoot && !isOpaque && q->testAttribute(Qt::WA_TintedBackground)) {
#ifndef QT_NO_OPENGL
beginBackingStorePainting(); beginBackingStorePainting();
#endif
QPainter p(q); QPainter p(q);
QColor tint = q->palette().window().color(); QColor tint = q->palette().window().color();
tint.setAlphaF(qreal(.6)); tint.setAlphaF(qreal(.6));
p.fillRect(toBePainted.boundingRect(), tint); p.fillRect(toBePainted.boundingRect(), tint);
#ifndef QT_NO_OPENGL
endBackingStorePainting(); endBackingStorePainting();
#endif
} }
} }

View File

@ -1158,6 +1158,7 @@ void QWidgetBackingStore::doSync()
return; return;
} }
#ifndef QT_NO_OPENGL
// There is something other dirty than the renderToTexture widgets. // There is something other dirty than the renderToTexture widgets.
// Now it is time to include the renderToTexture ones among the others. // Now it is time to include the renderToTexture ones among the others.
if (widgetTextures && widgetTextures->count()) { if (widgetTextures && widgetTextures->count()) {
@ -1167,6 +1168,8 @@ void QWidgetBackingStore::doSync()
toClean += rect; toClean += rect;
} }
} }
#endif
// The dirtyRenderToTextureWidgets list is useless here, so just reset. As // The dirtyRenderToTextureWidgets list is useless here, so just reset. As
// unintuitive as it is, we need to send paint events to renderToTexture // unintuitive as it is, we need to send paint events to renderToTexture
// widgets always when something (any widget) needs to be updated, even if // widgets always when something (any widget) needs to be updated, even if
@ -1249,8 +1252,10 @@ void QWidgetBackingStore::flush(QWidget *widget)
QWidget *target = widget ? widget : tlw; QWidget *target = widget ? widget : tlw;
qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures, this); qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures, this);
dirtyOnScreen = QRegion(); dirtyOnScreen = QRegion();
#ifndef QT_NO_OPENGL
if (widgetTextures && widgetTextures->count()) if (widgetTextures && widgetTextures->count())
return; return;
#endif
} }
if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty()) { if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty()) {

View File

@ -1191,10 +1191,12 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e)
case QEvent::DragMove: case QEvent::DragMove:
case QEvent::DragLeave: case QEvent::DragLeave:
#endif #endif
#ifndef QT_NO_OPENGL
// QOpenGLWidget needs special support because it has to know // QOpenGLWidget needs special support because it has to know
// its size has changed, so that it can resize its fbo. // its size has changed, so that it can resize its fbo.
if (e->type() == QEvent::Resize) if (e->type() == QEvent::Resize)
QWidgetPrivate::get(viewport())->resizeViewportFramebuffer(); QWidgetPrivate::get(viewport())->resizeViewportFramebuffer();
#endif
return QFrame::event(e); return QFrame::event(e);
case QEvent::LayoutRequest: case QEvent::LayoutRequest:
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES