Results 1 to 3 of 3

Thread: QGraphicsView resize not centered

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: QGraphicsView resize not centered

    You could also try calling this in your view constructor.

    Qt Code:
    1. QGraphicsView::setResizeAnchor( QGraphicsView::AnchorViewCenter );
    To copy to clipboard, switch view to plain text mode 

    I don't know if it will have the effect you want, but you shouldn't need a resize event handler in that case.

  2. #2
    Join Date
    May 2013
    Posts
    321
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    9
    Thanked 8 Times in 8 Posts

    Default Re: QGraphicsView resize not centered

    That gives the same effect, I have removed the resizeEvent to use "setResizeAnchor( QGraphicsView::AnchorViewCenter );".
    Thanks for the tip.

Similar Threads

  1. QGraphicsView resize and zoom
    By giostau in forum Qt Programming
    Replies: 0
    Last Post: 29th May 2013, 14:03
  2. Replies: 3
    Last Post: 11th December 2011, 10:09
  3. Replies: 7
    Last Post: 1st December 2011, 16:24
  4. QGraphicsView won't update until resize
    By stevel in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2009, 21:45
  5. getting QGraphicsView to resize
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2008, 03:49

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.