summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-08-27 09:30:26 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-08-27 09:43:51 +0300
commit15a088a1b4d63df74b547a9b7d5d4d1fb311ec29 (patch)
treea302a5b15d5b28a8159344d8de3ddb9bc8952f11
parent0d822bc5de5735b40fc0c76e366365ce1b6cab87 (diff)
Fix build issue with Qt 5.2.1
QImage is not a QObject, and therefore QImage::Format doesn't seem to be a supported type for a Q_PROPERTY, either. At least this was the case in Qt 5.2.1. In Qt 5.3.1 this worked. In any case, worked around the issue by removing textureFormat as a property. This shouldn't be an issue, since texture cannot meaningfully be manipulated from QML anyway. Also fixed some compile warnings. Change-Id: I257c1502d3340c49c24085fb8bf2e6176d875215 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
-rw-r--r--src/datavisualization/data/qcustom3dvolume.cpp49
-rw-r--r--src/datavisualization/data/qcustom3dvolume.h2
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp2
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp4
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp4
-rw-r--r--src/datavisualization/utils/abstractobjecthelper_p.h2
-rw-r--r--src/datavisualization/utils/objecthelper_p.h2
-rw-r--r--src/datavisualization/utils/scatterobjectbufferhelper.cpp2
-rw-r--r--src/datavisualization/utils/scatterobjectbufferhelper_p.h2
-rw-r--r--src/datavisualization/utils/scatterpointbufferhelper_p.h2
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h2
11 files changed, 44 insertions, 29 deletions
diff --git a/src/datavisualization/data/qcustom3dvolume.cpp b/src/datavisualization/data/qcustom3dvolume.cpp
index c1a77dba..503d324d 100644
--- a/src/datavisualization/data/qcustom3dvolume.cpp
+++ b/src/datavisualization/data/qcustom3dvolume.cpp
@@ -148,7 +148,7 @@ QCustom3DVolume::QCustom3DVolume(QObject *parent) :
* \a textureWidth, \a textureHeight, \a textureDepth, \a textureData, \a textureFormat,
* \a colorTable, and optional \a parent.
*
- * \sa textureData, textureFormat, colorTable
+ * \sa textureData, setTextureFormat(), colorTable
*/
QCustom3DVolume::QCustom3DVolume(const QVector3D &position, const QVector3D &scaling,
const QQuaternion &rotation, int textureWidth,
@@ -176,7 +176,7 @@ QCustom3DVolume::~QCustom3DVolume()
* \note The textureData may need to be resized or recreated if this value is changed.
* Defaults to \c{0}.
*
- * \sa textureData, textureHeight, textureDepth, textureFormat, textureDataWidth()
+ * \sa textureData, textureHeight, textureDepth, setTextureFormat(), textureDataWidth()
*/
void QCustom3DVolume::setTextureWidth(int value)
{
@@ -204,7 +204,7 @@ int QCustom3DVolume::textureWidth() const
* \note The textureData may need to be resized or recreated if this value is changed.
* Defaults to \c{0}.
*
- * \sa textureData, textureWidth, textureDepth, textureFormat
+ * \sa textureData, textureWidth, textureDepth, setTextureFormat()
*/
void QCustom3DVolume::setTextureHeight(int value)
{
@@ -233,7 +233,7 @@ int QCustom3DVolume::textureHeight() const
* \note The textureData may need to be resized or recreated if this value is changed.
* Defaults to \c{0}.
*
- * \sa textureData, textureWidth, textureHeight, textureFormat
+ * \sa textureData, textureWidth, textureHeight, setTextureFormat()
*/
void QCustom3DVolume::setTextureDepth(int value)
{
@@ -374,7 +374,7 @@ void QCustom3DVolume::setSliceIndices(int x, int y, int z)
*
* Defaults to \c{0}.
*
- * \sa textureData, textureFormat, QImage::colorTable()
+ * \sa textureData, setTextureFormat(), QImage::colorTable()
*/
void QCustom3DVolume::setColorTable(const QVector<QRgb> &colors)
{
@@ -414,7 +414,7 @@ QVector<QRgb> QCustom3DVolume::colorTable() const
*
* Defaults to \c{0}.
*
- * \sa colorTable, textureFormat, setSubTextureData(), textureDataWidth()
+ * \sa colorTable, setTextureFormat(), setSubTextureData(), textureDataWidth()
*/
void QCustom3DVolume::setTextureData(QVector<uchar> *data)
{
@@ -439,7 +439,7 @@ void QCustom3DVolume::setTextureData(QVector<uchar> *data)
*
* \return pointer to the newly created array.
*
- * \sa textureData, textureWidth, textureHeight, textureDepth, textureFormat
+ * \sa textureData, textureWidth, textureHeight, textureDepth, setTextureFormat()
*/
QVector<uchar> *QCustom3DVolume::createTextureData(const QVector<QImage *> &images)
{
@@ -573,9 +573,11 @@ void QCustom3DVolume::setSubTextureData(int depthIndex, const QImage &image)
}
}
-/*! \property QCustom3DVolume::textureFormat
- *
- * The format of the textureData. Only two formats are supported currently:
+// Note: textureFormat is not a Q_PROPERTY to work around an issue in meta object system that
+// doesn't allow QImage::format to be a property type. Qt 5.2.1 at least has this problem.
+
+/*!
+ * Sets the format of the textureData to \a format. Only two formats are supported currently:
* QImage::Format_Indexed8 and QImage::Format_ARGB32. If an indexed format is specified, colorTable
* must also be set.
* Defaults to QImage::Format_ARGB32.
@@ -596,12 +598,25 @@ void QCustom3DVolume::setTextureFormat(QImage::Format format)
}
}
+/*!
+ * \return the format of the textureData.
+ *
+ * \sa setTextureFormat()
+ */
QImage::Format QCustom3DVolume::textureFormat() const
{
return dptrc()->m_textureFormat;
}
/*!
+ * \fn void QCustom3DVolume::textureFormatChanged(QImage::Format format)
+ *
+ * This signal is emitted when the textureData \a format changes.
+ *
+ * \sa setTextureFormat()
+ */
+
+/*!
* \property QCustom3DVolume::alphaMultiplier
*
* The alpha value of every texel of the volume texture is multiplied with this value at
@@ -663,7 +678,7 @@ bool QCustom3DVolume::preserveOpacity() const
*
* \return the rendered image of the slice, or a null image if invalid index is specified.
*
- * \sa textureFormat
+ * \sa setTextureFormat()
*/
QImage QCustom3DVolume::renderSlice(Qt::Axis axis, int index)
{
@@ -688,12 +703,12 @@ const QCustom3DVolumePrivate *QCustom3DVolume::dptrc() const
QCustom3DVolumePrivate::QCustom3DVolumePrivate(QCustom3DVolume *q) :
QCustom3DItemPrivate(q),
- m_sliceIndexX(-1),
- m_sliceIndexY(-1),
- m_sliceIndexZ(-1),
m_textureWidth(0),
m_textureHeight(0),
m_textureDepth(0),
+ m_sliceIndexX(-1),
+ m_sliceIndexY(-1),
+ m_sliceIndexZ(-1),
m_textureFormat(QImage::Format_ARGB32),
m_textureData(0),
m_alphaMultiplier(1.0f),
@@ -711,12 +726,12 @@ QCustom3DVolumePrivate::QCustom3DVolumePrivate(QCustom3DVolume *q, const QVector
QImage::Format textureFormat,
const QVector<QRgb> &colorTable) :
QCustom3DItemPrivate(q, QStringLiteral(":/defaultMeshes/barFull"), position, scaling, rotation),
- m_sliceIndexX(-1),
- m_sliceIndexY(-1),
- m_sliceIndexZ(-1),
m_textureWidth(textureWidth),
m_textureHeight(textureHeight),
m_textureDepth(textureDepth),
+ m_sliceIndexX(-1),
+ m_sliceIndexY(-1),
+ m_sliceIndexZ(-1),
m_textureFormat(textureFormat),
m_colorTable(colorTable),
m_textureData(textureData),
diff --git a/src/datavisualization/data/qcustom3dvolume.h b/src/datavisualization/data/qcustom3dvolume.h
index 2f95fa5d..8627eb71 100644
--- a/src/datavisualization/data/qcustom3dvolume.h
+++ b/src/datavisualization/data/qcustom3dvolume.h
@@ -39,9 +39,9 @@ class QT_DATAVISUALIZATION_EXPORT QCustom3DVolume : public QCustom3DItem
Q_PROPERTY(int sliceIndexZ READ sliceIndexZ WRITE setSliceIndexZ NOTIFY sliceIndexZChanged)
Q_PROPERTY(QVector<QRgb> colorTable READ colorTable WRITE setColorTable NOTIFY colorTableChanged)
Q_PROPERTY(QVector<uchar> *textureData READ textureData WRITE setTextureData NOTIFY textureDataChanged)
- Q_PROPERTY(QImage::Format textureFormat READ textureFormat WRITE setTextureFormat NOTIFY textureFormatChanged)
Q_PROPERTY(float alphaMultiplier READ alphaMultiplier WRITE setAlphaMultiplier NOTIFY alphaMultiplierChanged)
Q_PROPERTY(bool preserveOpacity READ preserveOpacity WRITE setPreserveOpacity NOTIFY preserveOpacityChanged)
+
public:
explicit QCustom3DVolume(QObject *parent = 0);
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index 7cf7f020..9f0e2d8f 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -930,7 +930,7 @@ CustomRenderItem *Abstract3DRenderer::addCustomItem(QCustom3DItem *item)
QVector3D scaling = item->scaling();
QImage textureImage = item->d_ptr->textureImage();
bool facingCamera = false;
- GLuint texture;
+ GLuint texture = 0;
if (item->d_ptr->m_isLabelItem) {
QCustom3DLabel *labelItem = static_cast<QCustom3DLabel *>(item);
float pointSize = labelItem->font().pointSizeF();
diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp
index bc3893b9..94d49e3c 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -1748,8 +1748,8 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
QQuaternion totalRotation = Utils::calculateRotation(labelRotation);
if (m_polarGraph) {
- if (!m_yFlippedForGrid && (m_zFlipped != m_xFlipped)
- || m_yFlippedForGrid && (m_zFlipped == m_xFlipped)) {
+ if ((!m_yFlippedForGrid && (m_zFlipped != m_xFlipped))
+ || (m_yFlippedForGrid && (m_zFlipped == m_xFlipped))) {
totalRotation *= m_zRightAngleRotation;
} else {
totalRotation *= m_zRightAngleRotationNeg;
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 17be3278..58f97b0a 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -2159,8 +2159,8 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
QQuaternion totalRotation = Utils::calculateRotation(labelRotation);
if (m_polarGraph) {
- if (!m_yFlippedForGrid && (m_zFlipped != m_xFlipped)
- || m_yFlippedForGrid && (m_zFlipped == m_xFlipped)) {
+ if ((!m_yFlippedForGrid && (m_zFlipped != m_xFlipped))
+ || (m_yFlippedForGrid && (m_zFlipped == m_xFlipped))) {
totalRotation *= m_zRightAngleRotation;
} else {
totalRotation *= m_zRightAngleRotationNeg;
diff --git a/src/datavisualization/utils/abstractobjecthelper_p.h b/src/datavisualization/utils/abstractobjecthelper_p.h
index b12bc474..99f85dab 100644
--- a/src/datavisualization/utils/abstractobjecthelper_p.h
+++ b/src/datavisualization/utils/abstractobjecthelper_p.h
@@ -38,7 +38,7 @@ class AbstractObjectHelper: protected QOpenGLFunctions
protected:
AbstractObjectHelper();
public:
- ~AbstractObjectHelper();
+ virtual ~AbstractObjectHelper();
GLuint vertexBuf();
GLuint normalBuf();
diff --git a/src/datavisualization/utils/objecthelper_p.h b/src/datavisualization/utils/objecthelper_p.h
index c84f53bd..b00e5d8d 100644
--- a/src/datavisualization/utils/objecthelper_p.h
+++ b/src/datavisualization/utils/objecthelper_p.h
@@ -41,7 +41,7 @@ class ObjectHelper : public AbstractObjectHelper
private:
ObjectHelper(const QString &objectFile);
public:
- ~ObjectHelper();
+ virtual ~ObjectHelper();
static void resetObjectHelper(const Abstract3DRenderer *cacheId, ObjectHelper *&obj,
const QString &meshFile);
diff --git a/src/datavisualization/utils/scatterobjectbufferhelper.cpp b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
index 0ac1dd87..1639eb1f 100644
--- a/src/datavisualization/utils/scatterobjectbufferhelper.cpp
+++ b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
@@ -187,7 +187,7 @@ void ScatterObjectBufferHelper::updateUVs(ScatterSeriesRenderCache *cache)
QVector<QVector2D> buffered_uvs;
buffered_uvs.resize(uvsCount * renderArraySize);
- uint itemCount;
+ uint itemCount = 0;
if (cache->colorStyle() == Q3DTheme::ColorStyleRangeGradient) {
itemCount = createRangeGradientUVs(cache, buffered_uvs);
} else if (cache->colorStyle() == Q3DTheme::ColorStyleObjectGradient) {
diff --git a/src/datavisualization/utils/scatterobjectbufferhelper_p.h b/src/datavisualization/utils/scatterobjectbufferhelper_p.h
index c45febd1..08a42900 100644
--- a/src/datavisualization/utils/scatterobjectbufferhelper_p.h
+++ b/src/datavisualization/utils/scatterobjectbufferhelper_p.h
@@ -39,7 +39,7 @@ class ScatterObjectBufferHelper : public AbstractObjectHelper
{
public:
ScatterObjectBufferHelper();
- ~ScatterObjectBufferHelper();
+ virtual ~ScatterObjectBufferHelper();
void fullLoad(ScatterSeriesRenderCache *cache, qreal dotScale);
void update(ScatterSeriesRenderCache *cache, qreal dotScale);
diff --git a/src/datavisualization/utils/scatterpointbufferhelper_p.h b/src/datavisualization/utils/scatterpointbufferhelper_p.h
index b3adcfa8..d09ce0f7 100644
--- a/src/datavisualization/utils/scatterpointbufferhelper_p.h
+++ b/src/datavisualization/utils/scatterpointbufferhelper_p.h
@@ -39,7 +39,7 @@ class ScatterPointBufferHelper : public AbstractObjectHelper
{
public:
ScatterPointBufferHelper();
- ~ScatterPointBufferHelper();
+ virtual ~ScatterPointBufferHelper();
GLuint pointBuf();
diff --git a/src/datavisualization/utils/surfaceobject_p.h b/src/datavisualization/utils/surfaceobject_p.h
index 3266c626..f373eb5d 100644
--- a/src/datavisualization/utils/surfaceobject_p.h
+++ b/src/datavisualization/utils/surfaceobject_p.h
@@ -51,7 +51,7 @@ public:
public:
SurfaceObject(Surface3DRenderer *renderer);
- ~SurfaceObject();
+ virtual ~SurfaceObject();
void setUpData(const QSurfaceDataArray &dataArray, const QRect &space,
bool changeGeometry, bool polar, bool flipXZ = false);