Skip to content

Commit

Permalink
Make Qt3D buildable without widgets or opengl.
Browse files Browse the repository at this point in the history
Pull out all references to QGLContext, and QGLWidget and so on; and
replace with the equivalent from the gui library.  Where there is no
equivalent, eg the BindOptions enum, then reimplement.

Also get rid of the harmattan and symbian packaging goop.  This had
become completely unmaintainable, and was making it very hard to see
what dependencies were being pull in by the various parts of the build
system.  In order to have any confidence that conditional compilation
would not add in some problematic dependency, clean all this up.

Task-number: QTBUG-23299
Change-Id: Ied92ca1397076986e455674b064d8540bb13c0df
Reviewed-by: Sarah Jane Smith <[email protected]>
  • Loading branch information
Sarah Smith committed Dec 21, 2011
1 parent a7db0a7 commit aedf27c
Show file tree
Hide file tree
Showing 280 changed files with 902 additions and 2,118 deletions.
8 changes: 0 additions & 8 deletions demos/qt3d/cubehouse/cubehouse.desktop

This file was deleted.

5 changes: 1 addition & 4 deletions demos/qt3d/cubehouse/cubehouse.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
TEMPLATE = app
TARGET = cubehouse
CONFIG += qt warn_on
QT += widgets qt3d

CONFIG += qt3d_deploy_pkg
include(../../../pkg.pri)
QT += qt3d

SOURCES = cubeview.cpp main.cpp projectivetextureeffect.cpp
HEADERS = cubeview.h projectivetextureeffect.h
Expand Down
Binary file removed demos/qt3d/cubehouse/icon-l-qt3d.png
Binary file not shown.
14 changes: 0 additions & 14 deletions demos/qt3d/cubehouse/m5-cubehouse.desktop

This file was deleted.

5 changes: 3 additions & 2 deletions demos/qt3d/cubehouse/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@
**
****************************************************************************/

#include <QApplication>
#include <QGuiApplication>

#include "cubeview.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGuiApplication app(argc, argv);
CubeView view;

QStringList args = QCoreApplication::arguments();
Expand Down
3 changes: 2 additions & 1 deletion demos/qt3d/cubehouse/projectivetextureeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

#include <QFile>
#include "projectivetextureeffect.h"
#include <QtOpenGL/qglshaderprogram.h>

#include <QOpenGLShaderProgram>

static const QMatrix4x4 biasMatrix = QMatrix4x4(0.5, 0.0, 0.0, 0.5,
0.0, 0.5, 0.0, 0.5,
Expand Down
Binary file removed demos/qt3d/pageflip/icon-l-qt3d.png
Binary file not shown.
14 changes: 0 additions & 14 deletions demos/qt3d/pageflip/m5-pageflip.desktop

This file was deleted.

12 changes: 7 additions & 5 deletions demos/qt3d/pageflip/pageflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@
**
****************************************************************************/

#include <QApplication>
#include <QGuiApplication>
#include <QTimer>
#include <QMouseEvent>
#include <QWindow>
#include <QOpenGLContext>
#include <QOpenGLShaderProgram>

#include "qglpainter.h"
#include "qglabstracteffect.h"
#include "qgltexture2d.h"
#include "qglshaderprogrameffect.h"
#include <QtGui/QOpenGLContext>
#include <QtOpenGL/qglshaderprogram.h>

#include "pageflipmath_p.h"

class PageFlipGradientEffect;
Expand Down Expand Up @@ -359,7 +361,7 @@ void PageFlipView::update()
if (!updateQueued)
{
updateQueued = true;
QApplication::postEvent(this, new QExposeEvent(geometry()));
QGuiApplication::postEvent(this, new QExposeEvent(geometry()));
}
}

Expand Down Expand Up @@ -435,7 +437,7 @@ inline void PageFlipView::ensureContext()

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGuiApplication app(argc, argv);
PageFlipView view;

QStringList args = QCoreApplication::arguments();
Expand Down
8 changes: 0 additions & 8 deletions demos/qt3d/pageflip/pageflip.desktop

This file was deleted.

2 changes: 1 addition & 1 deletion demos/qt3d/pageflip/pageflip.pro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TEMPLATE = app
TARGET = pageflip
CONFIG += qt warn_on
QT += widgets qt3d
QT += qt3d

SOURCES = pageflip.cpp pageflipmath.cpp
HEADERS = pageflipmath_p.h
Expand Down
4 changes: 3 additions & 1 deletion demos/qt3d/pageflip/pageflipmath_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
#ifndef PAGEFLIPMATH_P_H
#define PAGEFLIPMATH_P_H

#include <QtOpenGL/qgl.h>
#include <QtGlobal>
#include <QRect>
#include <QOpenGLBuffer>

QT_BEGIN_NAMESPACE

Expand Down
1 change: 1 addition & 0 deletions demos/qt3d/photobrowser3d/bytereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <QUrl>
#include <QFile>
#include <QCoreApplication>
#include <QPainter>

ByteReader::ByteReader()
: m_stop(0), m_loading(0)
Expand Down
Binary file removed demos/qt3d/photobrowser3d/icon-l-qt3d.png
Binary file not shown.
5 changes: 3 additions & 2 deletions demos/qt3d/photobrowser3d/imagedisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
#include "qphotobrowser3dscene.h"
#include "photobrowser3dview.h"

#include <QApplication>
#include <QGuiApplication>
#include <QChildEvent>
#include <QCloseEvent>
#include <QUrl>
#include <QImage>

Expand Down Expand Up @@ -156,7 +157,7 @@ ImageDisplay::ImageDisplay(QObject *parent, QGLMaterialCollection *materials, qr
m_frameImage = qMakeFrameImage();
mat = new QGLMaterial();
tex = new QGLTexture2D(mat);
tex->setHorizontalWrap(QGL::Clamp);
tex->setHorizontalWrap(QGL::ClampToEdge);
tex->setImage(m_frameImage);
mat->setTexture(tex);
mat->setObjectName("loading image material - default");
Expand Down
1 change: 1 addition & 0 deletions demos/qt3d/photobrowser3d/imagedisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "qglmaterialcollection.h"

#include <QString>
#include <QImage>

QT_BEGIN_NAMESPACE
class QGLBuilder;
Expand Down
14 changes: 0 additions & 14 deletions demos/qt3d/photobrowser3d/m5-photobrowser3d.desktop

This file was deleted.

6 changes: 3 additions & 3 deletions demos/qt3d/photobrowser3d/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
**
****************************************************************************/

#include <QtWidgets/QApplication>
#include <QtCore/QThread>
#include <QGuiApplication>
#include <QThread>

#include "photobrowser3dview.h"

int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(photobrowser3d);

QApplication app(argc, argv);
QGuiApplication app(argc, argv);

// for QSettings
QCoreApplication::setOrganizationName("Nokia");
Expand Down
8 changes: 0 additions & 8 deletions demos/qt3d/photobrowser3d/photobrowser3d.desktop

This file was deleted.

7 changes: 1 addition & 6 deletions demos/qt3d/photobrowser3d/photobrowser3d.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
TEMPLATE = app
TARGET = photobrowser3d
CONFIG += qt warn_on
QT += widgets

include(../../../pkg.pri)
QT += qt3d opengl
QT += qt3d

SOURCES += main.cpp\
photobrowser3dview.cpp \
Expand Down Expand Up @@ -56,9 +54,6 @@ OTHER_FILES += \
shaders/replace_texture.fsh \
shaders/replace_texture.vsh

CONFIG += qt3d_deploy_pkg
include(../../../pkg.pri)

OTHER_FILES += \
photobrowser.rc

Expand Down
5 changes: 2 additions & 3 deletions demos/qt3d/photobrowser3d/photobrowser3dview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
#include "pancontroller.h"
#include "thumbnailnode.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QGuiApplication>
#include <QWheelEvent>
#include <QDir>
#include <QTimer>
Expand Down Expand Up @@ -328,7 +327,7 @@ void PhotoBrowser3DView::waitForExit()
}
}

void PhotoBrowser3DView::closeEvent(QCloseEvent *e)
void PhotoBrowser3DView::hideEvent(QHideEvent *e)
{
if (m_images)
{
Expand Down
2 changes: 1 addition & 1 deletion demos/qt3d/photobrowser3d/photobrowser3dview.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PhotoBrowser3DView : public QGLView
void resizeGL(int w, int h);
void wheelEvent(QWheelEvent *e);
void keyPressEvent(QKeyEvent *e);
void closeEvent(QCloseEvent *e);
void hideEvent(QHideEvent *e);
void mousePressEvent(QMouseEvent *e);
private slots:
void initialise();
Expand Down
4 changes: 2 additions & 2 deletions demos/qt3d/photobrowser3d/qatlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

#include <QImage>
#include <QThread>
#include <QGLFramebufferObject>
#include <QGLFramebufferObjectFormat>
#include <QOpenGLFramebufferObject>
#include <QOpenGLFramebufferObjectFormat>
#include <QCoreApplication>

#ifndef GL_MULTISAMPLE
Expand Down
5 changes: 3 additions & 2 deletions demos/qt3d/photobrowser3d/qatlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
#define QATLAS_H

#include <QSize>
#include <QtGui/QOpenGLFramebufferObject>
#include <QOpenGLFramebufferObject>
#include <QImage>

#include "qarray.h"
#include "qgeometrydata.h"
Expand All @@ -53,7 +54,7 @@ class QAreaAllocator;
class QGLTexture2D;
class QGLMaterial;
class QGeometryData;
class QGLFramebufferObject;
class QOpenGLFramebufferObject;
class QGLFramebufferObjectSurface;
QT_END_NAMESPACE

Expand Down
10 changes: 5 additions & 5 deletions demos/qt3d/photobrowser3d/thumbnaileffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#include "thumbnaileffect.h"

#include <QtOpenGL/qglshaderprogram.h>
#include <QOpenGLShaderProgram>

class ThumbnailEffectPrivate
{
Expand All @@ -56,7 +56,7 @@ class ThumbnailEffectPrivate
}
~ThumbnailEffectPrivate() { delete program; }

QGLShaderProgram *program;
QOpenGLShaderProgram *program;
int matrixUniform;
int thumbnailUniform;
int colorUniform;
Expand Down Expand Up @@ -103,9 +103,9 @@ void ThumbnailEffect::setActive(QGLPainter *painter, bool flag)
if (!d->program) {
if (!flag)
return;
d->program = new QGLShaderProgram();
d->program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/replace_texture.vsh");
d->program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/replace_texture.fsh");
d->program = new QOpenGLShaderProgram();
d->program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/replace_texture.vsh");
d->program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/replace_texture.fsh");
d->program->bindAttributeLocation("vertex", QGL::Position);
d->program->bindAttributeLocation("texcoord", QGL::TextureCoord0);
d->program->bindAttributeLocation("thumbcoord", QGL::TextureCoord1);
Expand Down
Binary file removed demos/qt3d/shapes/icon-l-qt3d.png
Binary file not shown.
14 changes: 0 additions & 14 deletions demos/qt3d/shapes/m5-shapes.desktop

This file was deleted.

13 changes: 7 additions & 6 deletions demos/qt3d/shapes/shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@
#include "qglcamera.h"
#include "qgltexture2d.h"
#include "qglsubsurface.h"
#include <QApplication>

#include <QGuiApplication>
#include <QImage>
#include <QPainter>
#include <QDebug>
#include <QtGui/QFontDatabase>

#include <QtGui/QWindow>
#include <QtGui/QOpenGLContext>
#include <QtGui/QSurfaceFormat>
#include <QWindow>
#include <QOpenGLContext>
#include <QSurfaceFormat>

class ShapesWidget : public QWindow
{
Expand Down Expand Up @@ -412,7 +413,7 @@ void ShapesWidget::paintTeapot(QGLPainter *painter, const QRect& rect)
void ShapesWidget::drawText
(QGLPainter *painter, const QRect& posn, const QString& str)
{
QFont f = QApplication::font();
QFont f = QGuiApplication::font();
QFontMetrics metrics(f);
QRect rect = metrics.boundingRect(str);
rect.adjust(0, 0, 1, 1);
Expand Down Expand Up @@ -483,7 +484,7 @@ void ShapesWidget::ensureContext()

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGuiApplication app(argc, argv);
ShapesWidget view;

QStringList args = QCoreApplication::arguments();
Expand Down
8 changes: 0 additions & 8 deletions demos/qt3d/shapes/shapes.desktop

This file was deleted.

Loading

0 comments on commit aedf27c

Please sign in to comment.