Results 1 to 4 of 4

Thread: how to prevent QGraphicsView() resizable by user

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to prevent QGraphicsView() resizable by user

    hi friends ,
    in normal QWidget() and QDialog() we can use
    layout()->setSizeConstraint(QLayout::SetFixedSize); to prevent user to resize the teh window ..
    how can i do it for graphicsView class ... there is no layout ..?

  2. #2
    Join Date
    Sep 2008
    Location
    Munich
    Posts
    32
    Thanked 8 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to prevent QGraphicsView() resizable by user

    But graphics view is normally contained in a parent widget, which has a layout. So you should try the magic there.
    If graphics view is the top-level widget, guess you can use setFixedSize(QSize).

    As graphics view is a scroll area it has a viewport widget (which actually displays the scene). So you might want to make that also fixed size and switch off the scrollbars. Haven't tried that part yet.

    - Juergen

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

    wagmare (24th February 2009)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to prevent QGraphicsView() resizable by user

    Quote Originally Posted by jryannel View Post
    But graphics view is normally contained in a parent widget, which has a layout. So you should try the magic there.
    If graphics view is the top-level widget, guess you can use setFixedSize(QSize).

    As graphics view is a scroll area it has a viewport widget (which actually displays the scene). So you might want to make that also fixed size and switch off the scrollbars. Haven't tried that part yet.

    - Juergen
    yes the view is the parent ...
    i try setSizeConstraint but not setFixedSize(QSize) ...

    to remove scroll bars i use
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) ;

  5. #4
    Join Date
    Feb 2009
    Posts
    18
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to prevent QGraphicsView() resizable by user

    I had a slightly different problem, (setting the maximum-size after which a user cannot make a window larger). But this is almost the same as setting a fixed size.

    I have an example in qt designer (log in to this forum so you can see the images) in the start post here, that works for simple dialogs, but not for qmainwindows (because these have their own layout handler).

Similar Threads

  1. Logging Qt User Actions
    By Frank J. Lhota in forum Qt Programming
    Replies: 14
    Last Post: 30th May 2014, 22:36
  2. user resizable and movable QLabel widget
    By hvengel in forum Qt Programming
    Replies: 8
    Last Post: 12th April 2007, 01:01

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.