Results 1 to 2 of 2

Thread: Moving to QtQuick2.0: use of QQuickItem in a QGraphicsScene

  1. #1
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Moving to QtQuick2.0: use of QQuickItem in a QGraphicsScene

    Hello,

    my application consist of a QGraphicsView with a scene containing a huge amount of QGraphicsItems. I found it useful to support QDeclarativeItems, so what i have done until now is creating of QDeclarativeItems and add them to a QGraphicsScene.
    With moving forward to QtQuick 2.0 ( Qt 5.1 ) this is no more possible. The QDeclarativeItem, derived from QGraphicsObject is substituted by QQuickItem, derived from QObject. So a QQuickItem can not be added to a scene.
    How can i achieve that? Or there something i obviously misunderstood?

    Best regards
    lunatic fringe

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Moving to QtQuick2.0: use of QQuickItem in a QGraphicsScene

    QGraphicsView/QDeclarativeView and QQuickView are both similar in that they show a scene of items, but they have very different implementations so they cannot share items.

    QDeclarativeView and QQuickView build the scene by reading a QML document and creating instances of type found in the document. That can be built-in types, e.g. "Text" or custom types (derived from QDeclarativeItem or QQuickItem respectively), registered through plugins or by the application itself using qmlRegisterType().

    So moving from a QDeclarativeView to a QQuickView with custom elements should involve mostly rebasing the custom types from QDeclarativeItem to QQuickItem (or more likely QQuickPaintedItem).

    Cheers,
    _

Similar Threads

  1. Extract QImage from QQuickItem
    By oberlus in forum Qt Quick
    Replies: 4
    Last Post: 20th September 2014, 10:42
  2. Garbled marks when moving items in QGraphicsScene
    By extralucas in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2010, 22:23
  3. Moving QGraphicsScene to Left or Right firections
    By augusbas in forum Qt Programming
    Replies: 2
    Last Post: 30th June 2010, 04:45
  4. Moving the QGraphicsScene background content
    By maverick_pol in forum Qt Programming
    Replies: 5
    Last Post: 16th May 2008, 07:37
  5. Moving an item in QGraphicsScene
    By prosass in forum Newbie
    Replies: 4
    Last Post: 28th March 2007, 14:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.