Results 1 to 2 of 2

Thread: getting QGraphicsView to resize

  1. #1
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default getting QGraphicsView to resize

    Hi,

    I've recently introduced a QGraphicsView into one
    of my dialogs replacing what was previously a layout
    of many buttons. The response time of the dialog is
    much improved, however I am not getting the resizing
    behaviour I need.

    In some cases I need to hide the lower half of the
    controls. As they are layed out together when I hide
    the controls and the respective QGraphicsItems that
    are contained in the lower portion of the QGraphicsView,
    I want the QGraphicsView to resize down to the vertical
    size that is only necessary to show the non hidden
    QGraphicsItems.

    However the QGraphicsView always stays the same size.
    I have tried various combinations of sizePolicy
    in QT Designer.

    How can I accomplish this?

    Thank you.

    Mark
    Attached Images Attached Images

  2. #2
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: getting QGraphicsView to resize

    Its not trivial to get it done using layouting or size policies alone. May be you can do something like the below after hiding the controls; And you might also need spacers and also you might need to experiment again with sizepolicies, minimum size...

    Qt Code:
    1. view->resize(scene->itemsBoundingRect().size());
    To copy to clipboard, switch view to plain text mode 
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. QGraphicsView
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th July 2007, 08:00
  2. QGraphicsScene / QGraphicsView speed after resize
    By themolecule in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2007, 23:46
  3. Speed, transparency, and drop issues with QGraphicsView
    By jefferai in forum Qt Programming
    Replies: 16
    Last Post: 30th June 2007, 16:14
  4. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 07:00
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00:32

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.