summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datavisualization/data/qsurface3dseries.cpp34
-rw-r--r--src/datavisualization/data/qsurface3dseries.h5
-rw-r--r--src/datavisualization/data/qsurface3dseries_p.h2
-rw-r--r--src/datavisualization/engine/drawer.cpp4
-rw-r--r--src/datavisualization/engine/surfaceseriesrendercache.cpp4
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h4
6 files changed, 52 insertions, 1 deletions
diff --git a/src/datavisualization/data/qsurface3dseries.cpp b/src/datavisualization/data/qsurface3dseries.cpp
index 94241dbc..f3e8e1fa 100644
--- a/src/datavisualization/data/qsurface3dseries.cpp
+++ b/src/datavisualization/data/qsurface3dseries.cpp
@@ -165,6 +165,12 @@ QT_BEGIN_NAMESPACE
* file name is set.
*/
+/*!
+ * \qmlproperty color Surface3DSeries::wireFrameColor
+ * \since 6.3
+ *
+ * The color used to draw the gridlines of the surface wireframe.
+ */
/*!
* \enum QSurface3DSeries::DrawFlag
@@ -399,6 +405,24 @@ QString QSurface3DSeries::textureFile() const
}
/*!
+ * \property QSurface3DSeries::wireFrameColor
+ * \since 6.3
+ *
+ * \brief The color for the surface wireframe.
+ */
+void QSurface3DSeries::setWireFrameColor(const QColor &color)
+{
+ if (dptr()->m_wireFrameColor != color) {
+ dptr()->setWireFrameColor(color);
+ emit wireFrameColorChanged(color);
+ }
+}
+
+QColor QSurface3DSeries::wireFrameColor() const
+{
+ return dptrc()->m_wireFrameColor;
+}
+/*!
* \internal
*/
QSurface3DSeriesPrivate *QSurface3DSeries::dptr()
@@ -420,7 +444,8 @@ QSurface3DSeriesPrivate::QSurface3DSeriesPrivate(QSurface3DSeries *q)
: QAbstract3DSeriesPrivate(q, QAbstract3DSeries::SeriesTypeSurface),
m_selectedPoint(Surface3DController::invalidSelectionPosition()),
m_flatShadingEnabled(true),
- m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe)
+ m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe),
+ m_wireFrameColor(Qt::black)
{
m_itemLabelFormat = QStringLiteral("@xLabel, @yLabel, @zLabel");
m_mesh = QAbstract3DSeries::MeshSphere;
@@ -553,4 +578,11 @@ void QSurface3DSeriesPrivate::setTexture(const QImage &texture)
static_cast<Surface3DController *>(m_controller)->updateSurfaceTexture(qptr());
}
+void QSurface3DSeriesPrivate::setWireFrameColor(const QColor &color)
+{
+ m_wireFrameColor = color;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
QT_END_NAMESPACE
diff --git a/src/datavisualization/data/qsurface3dseries.h b/src/datavisualization/data/qsurface3dseries.h
index eadc6622..7f02e491 100644
--- a/src/datavisualization/data/qsurface3dseries.h
+++ b/src/datavisualization/data/qsurface3dseries.h
@@ -48,6 +48,7 @@ class QT_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
Q_PROPERTY(DrawFlags drawMode READ drawMode WRITE setDrawMode NOTIFY drawModeChanged)
Q_PROPERTY(QImage texture READ texture WRITE setTexture NOTIFY textureChanged)
Q_PROPERTY(QString textureFile READ textureFile WRITE setTextureFile NOTIFY textureFileChanged)
+ Q_PROPERTY(QColor wireFrameColor READ wireFrameColor WRITE setWireFrameColor NOTIFY wireFrameColorChanged)
public:
enum DrawFlag {
@@ -81,6 +82,9 @@ public:
void setTextureFile(const QString &filename);
QString textureFile() const;
+ void setWireFrameColor(const QColor &color);
+ QColor wireFrameColor() const;
+
Q_SIGNALS:
void dataProxyChanged(QSurfaceDataProxy *proxy);
void selectedPointChanged(const QPoint &position);
@@ -89,6 +93,7 @@ Q_SIGNALS:
void drawModeChanged(QSurface3DSeries::DrawFlags mode);
void textureChanged(const QImage &image);
void textureFileChanged(const QString &filename);
+ void wireFrameColorChanged(const QColor &color);
protected:
explicit QSurface3DSeries(QSurface3DSeriesPrivate *d, QObject *parent = nullptr);
diff --git a/src/datavisualization/data/qsurface3dseries_p.h b/src/datavisualization/data/qsurface3dseries_p.h
index 16a8cb23..3b35cd22 100644
--- a/src/datavisualization/data/qsurface3dseries_p.h
+++ b/src/datavisualization/data/qsurface3dseries_p.h
@@ -60,6 +60,7 @@ public:
void setFlatShadingEnabled(bool enabled);
void setDrawMode(QSurface3DSeries::DrawFlags mode);
void setTexture(const QImage &texture);
+ void setWireFrameColor(const QColor &color);
private:
QSurface3DSeries *qptr();
@@ -69,6 +70,7 @@ private:
QSurface3DSeries::DrawFlags m_drawMode;
QImage m_texture;
QString m_textureFile;
+ QColor m_wireFrameColor;
private:
friend class QSurface3DSeries;
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index e83a1715..853e800b 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -197,6 +197,10 @@ void Drawer::drawSelectionObject(ShaderHelper *shader, AbstractObjectHelper *obj
void Drawer::drawSurfaceGrid(ShaderHelper *shader, SurfaceObject *object)
{
+ // Get grid line color
+ QVector4D lineColor = Utils::vectorFromColor(object->wireFrameColor());
+ shader->setUniformValue(shader->color(), lineColor);
+
// 1st attribute buffer : vertices
glEnableVertexAttribArray(shader->posAtt());
glBindBuffer(GL_ARRAY_BUFFER, object->vertexBuf());
diff --git a/src/datavisualization/engine/surfaceseriesrendercache.cpp b/src/datavisualization/engine/surfaceseriesrendercache.cpp
index 918d0fb6..545cee7e 100644
--- a/src/datavisualization/engine/surfaceseriesrendercache.cpp
+++ b/src/datavisualization/engine/surfaceseriesrendercache.cpp
@@ -66,6 +66,10 @@ void SurfaceSeriesRenderCache::populate(bool newSeries)
QSurface3DSeries::DrawFlags drawMode = series()->drawMode();
m_surfaceVisible = drawMode.testFlag(QSurface3DSeries::DrawSurface);
m_surfaceGridVisible = drawMode.testFlag(QSurface3DSeries::DrawWireframe);
+ QColor lineColor = series()->wireFrameColor();
+ m_surfaceObj->setLineColor(lineColor);
+ m_sliceSurfaceObj->setLineColor(lineColor);
+
if (m_flatChangeAllowed && m_surfaceFlatShading != series()->isFlatShadingEnabled()) {
m_surfaceFlatShading = series()->isFlatShadingEnabled();
m_flatStatusDirty = true;
diff --git a/src/datavisualization/utils/surfaceobject_p.h b/src/datavisualization/utils/surfaceobject_p.h
index 4532a671..9e317bb2 100644
--- a/src/datavisualization/utils/surfaceobject_p.h
+++ b/src/datavisualization/utils/surfaceobject_p.h
@@ -45,6 +45,7 @@
#include "qsurfacedataproxy.h"
#include <QtCore/QRect>
+#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
@@ -95,6 +96,8 @@ public:
float minYValue() const { return m_minY; }
float maxYValue() const { return m_maxY; }
inline void activateSurfaceTexture(bool value) { m_returnTextureBuffer = value; }
+ inline void setLineColor(const QColor &color) { m_wireFrameColor = color; }
+ inline const QColor &wireFrameColor() const { return m_wireFrameColor; }
private:
void createCoarseIndices(GLint *indices, int &p, int row, int upperRow, int j);
@@ -129,6 +132,7 @@ private:
bool m_returnTextureBuffer = false;
SurfaceObject::DataDimensions m_dataDimension;
SurfaceObject::DataDimensions m_oldDataDimension = DataDimensions(-1);
+ QColor m_wireFrameColor;
};
QT_END_NAMESPACE