[PyQt] Re: Getting QGraphicsWidget from methods that return QGraphicsItems

Aron Bierbaum aronbierbaum at gmail.com
Wed May 14 22:59:34 BST 2008


Sorry, I forgot to include the new code:

        case 11:
            // We need to explicitly cast because of the multiple inheritance.
            *sipCppRet = static_cast<QGraphicsWidget *>(sipCpp);
            sipClass = sipClass_QGraphicsWidget;
            break;

        case 12:
            // We need to explicitly cast because of the multiple inheritance.
            *sipCppRet = static_cast<QGraphicsProxyWidget *>(sipCpp);
            sipClass = sipClass_QGraphicsProxyWidget;
            break;


-Aron

On Wed, May 14, 2008 at 4:52 PM, Aron Bierbaum <aronbierbaum at gmail.com> wrote:
> 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