Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QSurfaceDataProxy not working in QML
Qt 6.11 is out! See what's new in the release blog

QSurfaceDataProxy not working in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 257 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sauropodbob
    wrote on last edited by
    #1

    Hi

    I am trying to use QSurfaceDataProxy from python in QML but I keep getting this error "Unable to assign [undefined] to QSurfaceDataProxy*".

    Can you help with what could be the cause? Thank you

    Here are the code snippets

    python snippet

    class Surface2(QObject):
        name_changed = Signal(QSurfaceDataProxy)
        simulator_nameChanged = Signal(str)
    
    
        def __init__(self, parent=None):
            QObject.__init__(self, parent)
            
            self.surfaceproxy = QSurfaceDataProxy()
            # self.surfaceseries = QSurface3DSeries(self.surfaceproxy)
            self.create_data()
            self.test_name = "blue"
    
        @Property(str, notify=simulator_nameChanged)
        def color_name(self):
            return self.test_name
    
        def create_data(self):
            x = [1,2,3]
            y = [3,4,5]
            z = [6,7,8]
    
            data_arr = []
            for i, item in enumerate(x):
                row = [QSurfaceDataItem(QVector3D(x[i], y[i], z[i]))]
                print(row[0].x())
                data_arr.append(row)
            self.surfaceproxy.resetArray(data_arr)
            print(self.surfaceproxy.rowCount())
            return self.surfaceproxy
    
        @Property(QSurfaceDataProxy, notify=name_changed)
        def output(self):
            return self.surfaceproxy
    

    qml snippet

            Surface3D {
                id: surfacePlot
                width: parent.width
                height: parent.height
                theme: Theme3D {
                        type: Theme3D.ThemeStoneMoss
                        font.family: "STCaiyun"
                        backgroundColor: surfaceDataModel.color_name
                        font.pointSize: 35
                        colorStyle: Theme3D.ColorStyleRangeGradient
    
    
                Surface3DSeries {
                    itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel"
                    dataProxy: surfaceDataModel.output
    
                }
            }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved