Results 1 to 2 of 2

Thread: Non scalable items, any idea?

  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 Non scalable items, any idea?

    I have a quick question. I am using the QGraphicsView framework(qt 4.3). I have a map drawn on the scene and need to scale it. But I have also created other items which should not be scaled. When I scale the map(QGraphicsView::scale(...)) I need that items not to change their sizes and coordinates.
    [CODE] QGraphicsItem::setFlat(....ItemIgnoresTransformati on)[CODE] works "almost" fine as my items do not change their sizes, but they change their coordinates.
    How can I scale the scene but set some items not to change their coordinates? Is it possible?.

    Any idea how the achieve the effect I need?


    Beforehand thanks.

    Maverick
    Last edited by maverick_pol; 16th July 2007 at 16:47.
    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
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Non scalable items, any idea?

    Well, you could use mapping methods to do this

    1) You obtain your item' initial coordinates mapped in viewport coordinates (with scene->mapToScene / viewport->mapFromScene)

    2) You store them in a QPoint

    3) Each time you apply a transformation to the scene, you can always restore the old item position since you have it in viewport coordinates...with inverse mapping


    Don't know if I am clear, and I don't know if it actually works (not tested) !

Similar Threads

  1. Selective highlighting of Items
    By Kapil in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 12:20

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.