Results 1 to 4 of 4

Thread: Hide widget, but not change layout

  1. #1
    Join Date
    Aug 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Hide widget, but not change layout

    How can I hide widget without rescaling other widgets.
    For example: hide() hides widget, but other widgets start changes their size (expand to hidden widget area). I don't need this. How can I make this in simple way?

  2. #2
    Join Date
    Sep 2008
    Location
    New York
    Posts
    90
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Hide widget, but not change layout

    try widget.setWindowOpacity(0) instead of hide(0, but the former one might not work in some environment.

    Quote Originally Posted by dimaz View Post
    How can I hide widget without rescaling other widgets.
    For example: hide() hides widget, but other widgets start changes their size (expand to hidden widget area). I don't need this. How can I make this in simple way?

  3. #3
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Re: Hide widget, but not change layout

    Hello, I tried it but with no success.

    I tried to hide a QLabel but ui.label->setWindowOpacity(0) does nothing at all

    OS: winXP
    Qt: 4.4.3

    Any other ideas?

  4. #4
    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: Hide widget, but not change layout

    If its just about few widgets, you can do the following -

    add the widget(s) to a Qwidget which will act as a holder for them. Now when u want to hide the widget, hide them, the widget/placeholder will still be there, and other widgets wont resize

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 08:06
  2. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 21:21
  3. Move and resize with layout
    By waediowa in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2008, 09:16
  4. resizing events of a custom widget in a layout
    By Rooster in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2008, 11:52
  5. Replies: 3
    Last Post: 21st March 2006, 17:48

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.