Results 1 to 4 of 4

Thread: Creating a scene from piece of another scene

  1. #1
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Creating a scene from piece of another scene

    Hi,

    I am trying to to implement zooming in the viewport like this:
    I choose a rectangle from the current scene, then I would like to create another scene which would show only the chosen rectangle, and so on(of course I would remove the old scene from the viewport).
    For now I use scale() method which scales the whole scene, and it takes about 1 or 2 sec to paint it again.
    How to create a scene using a rectangle from another scene? I draw the scene contents in the background and add some items. How to copy the part of the background and items to another scene?

    Thank you for any ideas.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  2. #2
    Join Date
    Aug 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Creating a scene from piece of another scene

    Hi

    I guess you may use a QGraphicsScene::render method to create a copy of a rectangle in another QPaintDevice. It'll work if you don't need to copy the items themselves, but only their "view".

    Or, you may copy the items which boundingRect intersects the rectangle to a new scene.
    Or, you may not copy them, but just change items' parent.

    Does this fit?

  3. #3
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Creating a scene from piece of another scene

    Sound like a good solution, will test it right away.

    THanks.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  4. #4
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Creating a scene from piece of another scene

    Hi,

    Could anyone explain how to use QGraphicsScene::render method?

    m_scene - > current scene;
    _rectangle -> piece of the scene(rectangle) which I want to zoom In and create the whole scene from it

    How to create a new scene or replace the old scene with the _rectangle using render?

    Thank you.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

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.