From 15a088a1b4d63df74b547a9b7d5d4d1fb311ec29 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 27 Aug 2014 09:30:26 +0300 Subject: Fix build issue with Qt 5.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ää --- src/datavisualization/data/qcustom3dvolume.cpp | 49 +++++++++++++++++--------- src/datavisualization/data/qcustom3dvolume.h | 2 +- 2 files changed, 33 insertions(+), 18 deletions(-) (limited to 'src/datavisualization/data') 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 &colors) { @@ -414,7 +414,7 @@ QVector QCustom3DVolume::colorTable() const * * Defaults to \c{0}. * - * \sa colorTable, textureFormat, setSubTextureData(), textureDataWidth() + * \sa colorTable, setTextureFormat(), setSubTextureData(), textureDataWidth() */ void QCustom3DVolume::setTextureData(QVector *data) { @@ -439,7 +439,7 @@ void QCustom3DVolume::setTextureData(QVector *data) * * \return pointer to the newly created array. * - * \sa textureData, textureWidth, textureHeight, textureDepth, textureFormat + * \sa textureData, textureWidth, textureHeight, textureDepth, setTextureFormat() */ QVector *QCustom3DVolume::createTextureData(const QVector &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,11 +598,24 @@ 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 * @@ -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 &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 colorTable READ colorTable WRITE setColorTable NOTIFY colorTableChanged) Q_PROPERTY(QVector *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); -- cgit v1.2.3