Change line width in Q3DSurface
-
Hello, i want to make 3D Spline chart
I decided to do this with the help of Q3DSurfacePart of code:
QWidget *wdg = new QWidget;
float minX = std::numeric_limits<float>::max(),
minY = std::numeric_limits<float>::max(),
minZ = std::numeric_limits<float>::max(),
maxX = std::numeric_limits<float>::min(),
maxY = std::numeric_limits<float>::min(),
maxZ = std::numeric_limits<float>::min();
Q3DSurface *graph = new Q3DSurface();
QWidget *container = QWidget::createWindowContainer(graph);
QHBoxLayout *hLayout = new QHBoxLayout(wdg);
hLayout->addWidget(container, 1);
QSurfaceDataProxy *prox = new QSurfaceDataProxy();
QSurface3DSeries *series = new QSurface3DSeries(prox);
QSurfaceDataArray *dataArray = new QSurfaceDataArray;
int index = 0;
int size = sqlSize(query);
dataArray->reserve(size);
QSurfaceDataRow *newRow = new QSurfaceDataRow(size);
while (query.next())
{
float x = query.value(2).toFloat();
if (x<minX)
minX=x;
if (x>maxX)
maxX=x;
float y = query.value(1).toFloat();
if (y<minY)
minY=y;
if (y>maxY)
maxY=y;
float z = query.value(0).toFloat();
if (z<minZ)
minZ=z;
if (z>maxZ)
maxZ=z;
(*newRow)[index++].setPosition(QVector3D(x, y, z));
*dataArray << newRow;
}
QRect rec = QApplication::desktop()->screenGeometry();
double height = rec.height();
double width = rec.width();
graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
graph->activeTheme()->setFont(font);
graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftLow);
graph->axisX()->setRange(minX-100, maxX+100);
graph->axisY()->setRange(minY-100, maxY+100);
graph->axisZ()->setRange(minZ-100, maxZ+100);
wdg->setGeometry(width/4, height/4, width/2, height/2);
prox->resetArray(dataArray);
graph->addSeries(series);
wdg->show();But result line is very small, i want to change color and thickness.
graph->activeTheme()->setFont(font) change only label and legends
Hope on your help)
Maybe i need not Q3DSurface?
-
@zloi_templar
Hi i think we have same requirement, i don't know how to display the 3d points and 3d spline so i use 3dscatter .for changing the point size and color , i use the code as below
QLinearGradient ClinearGrad(QPointF(100, 100), QPointF(200, 200));
ClinearGrad.setColorAt(0, Qt::green);
ClinearGrad.setColorAt(1, Qt::green);
CuSeries.setColorStyle(Q3DTheme::ColorStyleObjectGradient);
CuSeries.setBaseGradient(ClinearGrad);
CuSeries.setItemSize(0.02);
graph->addSeries(&CuSeries);
graph->seriesList().at(1)->setBaseColor(Qt::green);maybe you can find some way to get line size and color.
Could you show me more code to display 3d points and 3d spline by Q3Dsurface?
jeff
-
@cawlfj
it's all my code)Q3DSurface automaticaly makes lines for your input data
if you will set 3-axes, you will get line
4-axes - surfaceand i using QSurface3DSeries
Q3DSurface *graph = new Q3DSurface();
QWidget *container = QWidget::createWindowContainer(graph);
QHBoxLayout *hLayout = new QHBoxLayout(wdg);
hLayout->addWidget(container, 1);
QSurfaceDataProxy *prox = new QSurfaceDataProxy();
QSurface3DSeries *series = new QSurface3DSeries(prox);
QSurfaceDataArray *dataArray = new QSurfaceDataArray;