Q3DScatter in Widget Application



  • Hi
    I am trying to use Q3DScatter in widget application.
    I added a qwidget on UI and promoted it to a class which has function like below to simply create scatter graph.

    scatterCloud::scatterCloud(QWidget *parent) : QWidget(parent)
    {
    
        Q3DScatter *scatter3d = new Q3DScatter();
        QWidget::createWindowContainer(scatter3d);
        //QWidget *container = QWidget::createWindowContainer(scatter3d);
    
    
        QScatter3DSeries *series = new QScatter3DSeries;
        QScatterDataArray data;
        data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f);
        series->dataProxy()->addItems(data);
    
        scatter3d->addSeries(series);
        scatter3d->show();
    }
    

    It seems working but nothing is showing up.
    How could I make it work?

    Thanks



  • either:

    • pass a parent to createWindowContainer
    • add QWidget *container to a layout
    • call container->show()

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.