[PyQt] Getting QGraphicsWidget from methods that return QGraphicsItems

Aron Bierbaum aronbierbaum at gmail.com
Wed May 14 22:52:28 BST 2008


I have been having problems when trying to iterate over a list
returned from QGraphicsScene.items(). It appears that even though I
add a QGraphicsWidget instance, I never get it back out. I actually
traced this down when trying to add support to PyQt for Qt 4.4 a few
months ago. The following needs to be added to qgraphicsitem.sip


%ConvertToSubClassCode
    switch (sipCpp->type())
        {
        case 2:
            sipClass = sipClass_QGraphicsPathItem;
            break;
        ...

        case 9:
            sipClass = sipClass_QGraphicsSimpleTextItem;
            break;

        case 10:
            sipClass = sipClass_QGraphicsItemGroup;
            break;

        default:
            sipClass = 0;
        }
%End


Thanks,
Aron


More information about the PyQt mailing list