[commonqt-devel] Template class in CommonQt (e.g. QList)

Stas Boukarev stassats at gmail.com
Thu Sep 12 14:18:34 UTC 2013


Rujia Liu <rujia.liu at gmail.com> writes:

> Hi!
>
> I'd like to create an item group for a QGraphicsScene with this function:
>
> QGraphicsItemGroup * QGraphicsScene::createItemGroup ( const
> QList<QGraphicsItem *> & items )
>
> However, I don't know how to create a variable of type
> QList<QGraphicsItem*>.
> I even can't find the class:
>
> * (qt:qapropos "QList")
> ; No debug variables for current frame: using EVAL instead of EVAL-IN-FRAME.
> Class QListView
> Class QListWidget
> Class QListWidgetItem
> Method QListView::QListView [7272]
> Method QListView::QListView [7342]
> Method QListView::~QListView [7356]
> Method QListWidget::QListWidget [7364]
> Method QListWidget::QListWidget [7422]
> Method QListWidget::~QListWidget [7426]
> Method QListWidgetItem::QListWidgetItem [7427]
> Method QListWidgetItem::QListWidgetItem [7428]
> Method QListWidgetItem::QListWidgetItem [7429]
> Method QListWidgetItem::QListWidgetItem [7430]
> Method QListWidgetItem::QListWidgetItem [7472]
> Method QListWidgetItem::QListWidgetItem [7473]
> Method QListWidgetItem::QListWidgetItem [7474]
> Method QListWidgetItem::QListWidgetItem [7475]
> Method QListWidgetItem::QListWidgetItem [7476]
> Method QListWidgetItem::QListWidgetItem [7477]
> Method QListWidgetItem::~QListWidgetItem [7480]
>
> I tried to call canvas's items() and see what's inside. Then I see
>
> (#<QGraphicsItem 0x01FEB0B8> #<QGraphicsItem 0x01FEABB8>)
>
> That's the two items I created, before calling items(). So I see CommonQt
> does some magic to convert QList to a lisp list.
>
> Then I tried to pass nil (here I mean empty list, not false) to
> createItemGroup, but I got the following: The value NIL is not of type
> SYSTEM-AREA-POINTER. I think that's because nil is not like a "C pointer",
> but I know almost nothing about CFFI or other low-level stuffs, so I'm
> stuck now.
There's something strange going on, I added a QList<QGraphicsItem*>
marshaller, but when i try to use it with #_createItemGroup, it crashes
hard with free(): invalid pointer: 0x00007ffff4375350.

You're probably better off for now with explicit item group functions,
like (#_addToGroup QGraphicsItemGroup item)

-- 
With best regards, Stas.



More information about the commonqt-devel mailing list