[PyQt] Creating a QSGGeometry.AttributeSet in PyQt5

pwuertz pwuertz at gmail.com
Fri Feb 21 13:08:13 GMT 2014


Hi,
I am trying to add a vertex array to a QSGGeometryNode for a custom QtQuick
Item. Qt5 uses QSGGeometry for that purpose and requires the user to define
a QSGGeometry.AttributeSet that describes structure of a vertex array. There
are a few pre-defined structures like the one from
defaultAttributes_Point2D() but I need to create my own as described in
http://qt-project.org/doc/qt-5/qsggeometry.html.

QSGGeometry::Attribute MyPoint2D_Attributes[] = {
    QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
    QSGGeometry::Attribute::create(1, 4, GL_FLOAT, false)
};

QSGGeometry::AttributeSet MyPoint2D_AttributeSet = {
    2,
    sizeof(MyPoint2D),
    MyPoint2D_Attributes
};

The problem is that I don't know how to create a QSGGeometry.AttributeSet in
PyQt5, which C++ creates by struct initialization. AttributeSet doesn't have
an initializing constructor and naively assigning a list of Attributes to a
default constructed instance fails because AttributeSet.attributes is
read-only. How can I construct a complete AttributeSet in PyQt5?




--
View this message in context: http://python.6.x6.nabble.com/Creating-a-QSGGeometry-AttributeSet-in-PyQt5-tp5048156.html
Sent from the PyQt mailing list archive at Nabble.com.


More information about the PyQt mailing list