Important: Please read the Qt Code of Conduct -

color on q3dsurface only shows when zooming in

  • I've drawn a simple Q3DSurface. All seems to work OK, except the color only appears when I right click, mouse wheel zoom in, as close as I can to the surface. This is true for a solid color or a linear gradient. I've been through the Q3DSurface example line by line (the example works fine, I see the color immediately when I run the app) and I can't see anything significant that I think would cause this behavior. Can someone point out what I may be dong wrong? Note that the variable 'graph' is a Q3DSurface object.

    m_dataProxy = new QSurfaceDataProxy();
    m_dataSeries = new QSurface3DSeries(m_dataProxy);

    QLinearGradient gr;
    gr.setColorAt(0.0, Qt::darkGreen);
    gr.setColorAt(0.5, Qt::yellow);
    gr.setColorAt(0.8, Qt::red);
    gr.setColorAt(1.0, Qt::darkRed);
    QSurfaceDataArray *dataArray = new QSurfaceDataArray;
    QSurfaceDataRow *tempRow1 = new QSurfaceDataRow(100);
    QSurfaceDataRow *tempRow2 = new QSurfaceDataRow(100);
    QSurfaceDataRow *tempRow3 = new QSurfaceDataRow(100);
    for (int i = 0 ; i < 100 ; i++)
    *dataArray << tempRow1;
    *dataArray << tempRow2;
    *dataArray << tempRow3;

  • @stevereine

    I solved my own problem, was drawing the graph in a Window, but not using a container to do it. It kind of works, but not very good. Always best to thoroughly understand the instructions before writing code. All is now working very well!

Log in to reply