[Qt-interest] QGraphicsView or Qwidget
Parta
lists4pghanghas at gmail.com
Fri Feb 26 14:23:07 CET 2010
On Fri, Feb 26, 2010 at 4:51 PM, Samuel Rødal <samuel.rodal at nokia.com> wrote:
> ext Parta wrote:
>>
>> Hi
>>
>> I am going to write a media Player for a embedded system. The system
>> doesn't have support for OGL or floating point in hardware.
>> Now I am confused what should I use QWidget or QGraphicsView
>> framework. I am inclined to implement it as a QGraphicsView Item.
>> It seems to give more control over look and feel of the thing but will
>> take a little more time than using standard QWidgets like sliderbar.
>> Though I can embed anything into QGV with proxywidget. But still I
>> dont like the idea of making it a mixup of graphicsitems and QWigets.
>>
>> One more thing that is giving me hard time is:
>>
>> When I animate a item(item has many children), for every frame the
>> scene seems to call all the children paint functions. That kill frame
>> rates on the modest
>> hardware that I have. I was thinking of caching the whole frame(only
>> the bounding area of the parent) when the first frame is drawn and
>> then animate that pixmap for the
>> animation because during animation the children don't change how they
>> look. they remain the same throughout the animation. this works but
>> this approach is a little ugly in my view.
>> Is there a cleaner, standard way in which I can achieve something like
>> that using Qt.
>>
>> Any thoughts are appreciated.
>>
>> --
>> Regards,
>> Parta
>
> Graphics items can be cached as pixmaps by using
> QGraphicsItem::setCacheMode(QGraphicsItem::ItemCoordinateCache);
>
> or DeviceCoordinateCache if your item is heavily scaled.
>
> --
> Samuel
>
>
Thank you for your insight....
That I had seen and tried. As far as I understand it, it caches on
the item level. Item has cache for its own drawings, it doesnt cache
drawings of its children.
As I observed it, paint calls are still made for the children. Anyway
I don't think I am gaining much by caching all the pixmap data at a
single parent level, just a few calls probably.
Though I was surprised when you said that I should use
"DeviceCoordinateCache if my item is heavily scaled", as I have read
from documentation if my item is heavily scaled I wont get any
benefit from DeviceCoordinateCache as it will be very time
regenerated. Or you meant that if the item is heavily scaled it wise
to use DeviceCoordinateCache as it automatically regenerates the
cache
while itemCoordinateCache wont do that unless I ask it to do so.
My other problem of deciding between QGraphicsView and QWidget is more
dear to me right now. And I am sorry for reporting that I dont have
fpu.
Its just that if any operation requires fpu supports it becomes cpu
bound on my hardware. My GPU doesnt have fpu support. So no
acceleration for
animations requiring floating point calculations. And all of
QGraphicsView requires floating point calculations. I am going to try
a small animation in both
QGV and QWIdget and report my findings.
--
--
Regards,
Parta
More information about the Qt-interest-old
mailing list