Solved Initialzing QSurfaceDataProxy Problems
-
I'm simply trying to use QSurfaceDataProxy in my c++ code, so that I can do:
negativeTabView->findChild<QSurfaceDataProxy *>("proxyTest");
Where 'negativeTabView' is a QQuickView object, and 'proxyTest' is the ItemModelSurfaceDataProxy from a Surface3DSeries in QML, like this:
Surface3DSeries { id: surfaceSeries flatShadingEnabled: false drawMode: Surface3DSeries.DrawSurface baseGradient: surfaceGradient colorStyle: Theme3D.ColorStyleRangeGradient itemLabelFormat: "(@xLabel, @zLabel): @yLabel" onSelectedPointChanged: getSurfaceDataItem(itemLabel, selectedPoint) ItemModelSurfaceDataProxy { id:surfaceSeriesDataProxy objectName: proxyTest itemModel: surfaceData0.model rowRole: "radius" columnRole: "angle" yPosRole: "value" } }
I cannot share my full code, but in my main.h I have included QSurfaceDataProxy, added the namespace, and added one QSurfaceDataProxy object in the private section, as such:
#include <QtDataVisualization/QSurfaceDataProxy> using namespace QtDataVisualization; ... QSurfaceDataProxy *m_dataProxy;
In my main.cpp I have done included the same line
#include <QtDataVisualization/QSurfaceDataProxy>
without the namespace. If I try to instantiate the m_dataproxy variable like such:
m_dataProxy = new QSurfaceDataProxy();
or
m_dataProxy = negativeTabView->findChild<QSurfaceDataProxy *>("proxyTest");
It will lead to this error (full path removed)
C:\\....main.cpp:-1: error: undefined reference to `__imp__ZN19QtDataVisualization17QSurfaceDataProxyC1EP7QObject'
What am I doing wrong?
Here is the top of my .pro file:QT += core gui charts quickwidgets qml quick greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport CONFIG += c++11
What am I doing wrong?
Using https://doc.qt.io/qt-5.9/qtdatavisualization-surface-surfacegraph-h.html as reference, they seem to instantiate their QSurfaceDataProxy in the same manner with no issues.Thank you.
-
@LordOfTheMorning Please read https://doc.qt.io/qt-5/qtdatavisualization-index.html
You have to addQT += datavisualization
-
@jsulm
Ah man I thought I added that to the pro file. Thanks jsulm.Marked resolved.