Q3DSurface: QAstractItemModel or QSurfaceDataArray?



  • Hello everyone.

    I need to display a 3D surface on my GUI and I want to use the Q3DSurface c++ class. The data is continuously downloaded through a QTCPSocket and I want a refresh rate of at least 10-20 frames per second. Therefore I need to update my surface fairly quickly.

    In the examples, I've seen they use two difference approaches to display some data on a Q3DSurface:

    1. the QItemModelSurfaceDataProxy that takes as input a QAstractItemModel as HERE;
    2. the QSurfaceDataProxy which takes a QSurfaceDataArray as in the Surface example.

    Which approach is better suited for my purpose?

    Moreover, if the model based approach is better, the link above gives as example

    QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(customModel,
                                             QStringLiteral("longitude"), // Row role
                                             QStringLiteral("latitude"), // Column role
                                             QStringLiteral("height")); // Y-position role
    

    How do I implement such customModel? I've read some articles about subclassing QAstractItemModel, but I couldn't find how do I create such "longitude", "latitude" and "height" roles.
    Can anyone give me some help/example for doing that?

    Thank you.
    Bye


Log in to reply
 

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