[PyQt] Graphic view
Frédéric
frederic.mantegazza at gbiloba.org
Wed Jan 21 15:00:56 GMT 2009
Le 18/1/2009, "Nahuel Defossé" <nahueldefosse at yahoo.com.ar> a écrit:
>El Saturday 17 January 2009 20:37:15 Frédéric escribió:
>
>> I would like to implement this like Mark explains for tables, in its
>> paper, "Qt 4's Model/View Delegates". As I'm new to Qt4, could you point
>> me to the good direction? I'm a bit lost in all the classes available
>> (QGraphicsScene/View/item...). Are there some example, somewhere?
>
>Check the code attached. It's a basic QGraphicItem subclass which has it paint
>method overriden (check QPainter docs and QGraphicsItem.shape). It also
>listens to mouse events. If you want to do some changes when the item is hit
>by the mouse, you might want to call to update() after.
What I'm looking for, now, is to use the Model-View-Delegate mecanism to
display the images in the shooting area. But I'm a bit lost :o/ What I
understood is that the QGraphicsView I have to use will also be an
abstract item view for the MVD pattern. I tried to implement something,
but it does not work (see attached). It is far from complete, but here
are the two main problems:
1) ShootingView inherits QGraphicsView and QAbstractItemViewn but when I
try to use the , like setModel() or setItemDelegate(), it does not work
(AttributeError: setModel).
2) Things are not clear to me how to complete this design: I don't know
where I should build and update the images representation (mainly a
rectangle or circle with a border and background).
Maybe I'm not on the right way, but it seems to me that such solution
could be great: updating the list containing the status of all images
should automatically update the view.
Thanks,
--
Frédéric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graphics-mvd.py
Type: application/x-python
Size: 3654 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090121/6e925778/graphics-mvd.bin
More information about the PyQt
mailing list