Results 1 to 20 of 22

Thread: change bounding of QGraphicsScene

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    thanks for your reply,
    but how can i force QGraphicsScene to show only middle of circle and zoom in and out or panning only my qgraphicssvgitem, whats the best solution? for now i using a custom widget and mask circle area on it and add a qgraphicsview to this widget but this solution isn't good for me, so i googled of any other solution and masking on qgraphicsscene or qgraphicsview itself but without any success, if you explain more your suggestion for me i will thank of you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    You can enable clipping for the view to only allow drawing on certain area. However that will have impact on performance.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    danics (15th July 2012)

  4. #3
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    Quote Originally Posted by wysota View Post
    You can enable clipping for the view to only allow drawing on certain area. However that will have impact on performance.
    its not so much good for me, because my svg file is really big so i think i must draw all of my items in a image and paint that and then every-time i m need to scale my map change whole background image, but QGraphicsScene havent paintevent and i dont know when drawbackground() of this class is calling and how to work,
    another problem for me is some graphical widget that i dont need add their to qgraphicsscene( outside of this circle only added to Qgraphicsview)
    can i change paintevent of qgraphicsview for rendering my scene only and dont repaint these widgets?
    or i must create whole of my radar as a QgraphicsItem in this case how can i just repaint this item in whole scene and implement scaling for svg map?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    Maybe you should start from the beginning and tell us what exactly you are trying to do. I mean, something more detailed than that you're drawing a radar screen.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    i say you, you imagine you have a svg map like worldmap that you want add that in the center of some circles like radar, you have some target added in this map and you can select or move them and some button outside of this circle for changing zooming and panning and adding target to this map.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    Quote Originally Posted by danics View Post
    i say you, you imagine you have a svg map like worldmap that you want add that in the center of some circles like radar, you have some target added in this map and you can select or move them and some button outside of this circle for changing zooming and panning and adding target to this map.
    Sorry, this description is too vague to make out anything of it. I'm asking about your goals, not methods of achieving them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    danics (16th July 2012)

  9. #7
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    Quote Originally Posted by wysota View Post
    Sorry, this description is too vague to make out anything of it. I'm asking about your goals, not methods of achieving them.
    my goals?
    so, loading a large svg file and creating some special map viewer for this file,
    for not confusing anyone else i ask another questions and myself decide how implement that,
    -how can i draw a svg file in background of a QGraphicsScene that cover whole scene?
    -- when scaling a scene my background must scale too?

    tnx for your attention again.

  10. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    Quote Originally Posted by danics View Post
    my goals?
    so, loading a large svg file and creating some special map viewer for this file,
    We won't make progress this way, you know...

    But let's have it your way...

    -how can i draw a svg file in background of a QGraphicsScene that cover whole scene?
    For example using QGraphicsScene::drawBackground()
    -- when scaling a scene my background must scale too?
    It can, it doesn't have to.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #9
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    but when i use paint method of QGraphicsSvgItem in drawpackground function its size isnt set with the size of scene how can i do this?

  12. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    drawBackground() has nothing to do with items. You are supposed to paint directly on a given painter.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #11
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    if i want draw svg file like raster files so why i must use svg? any other solution for changing scale and full view of a svg item in scene, and then clipping a rectangle of that

  14. #12
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: change bounding of QGraphicsScene

    I dont think QGraphicsscene will be a good choice for you. You will need to re-draw the SVG at different scales...
    so a simple paint method will do.
    QGraphicsScene will help you only if you opt for opengl.

  15. The following user says thank you to aamer4yu for this useful post:

    danics (18th July 2012)

  16. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change bounding of QGraphicsScene

    Quote Originally Posted by danics View Post
    if i want draw svg file like raster files so why i must use svg?
    You don't have to use SVG. Besides I have no idea what does it have to do with this situation.

    any other solution for changing scale and full view of a svg item in scene, and then clipping a rectangle of that
    There are lots of possible solutions but they all involve rasterizing the SVG at some point. Unfortunately physical devices have limited resolution so at some point they need to have a raster rather than mathematical representation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. The following user says thank you to wysota for this useful post:

    danics (18th July 2012)

Similar Threads

  1. Replies: 2
    Last Post: 1st October 2011, 09:11
  2. How change selected item rectangle on QGraphicsScene
    By xray2000 in forum Qt Programming
    Replies: 1
    Last Post: 18th May 2010, 16:43
  3. Replies: 2
    Last Post: 29th March 2010, 12:34
  4. Getting the bounding rectangle
    By ioannis in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2009, 00:41
  5. Replies: 4
    Last Post: 16th March 2009, 09:08

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.