Results 1 to 3 of 3

Thread: height/width resize issue

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default height/width resize issue

    I have a minor issue that has been bugging me for a while. It's about automatic layout resizing when a contained widget is hidden at runtime:


    The user hits a button and a QtableWidget gets hidden (i call setVisible(false) on it). The problem lies with the resizing.


    By default, the dialog size doesnt change, which leaves a lot of ugly empty space, but the user could reduce the height to fix that.


    Now, if i call layout()->setSizeConstraint(QLayout::SetFixedSize); on my layout, the resizing happens automatically - however, the user cant change the size any more. This also resizes both height and width (even though only height should be affected).



    The issue is that the user should be able to resize the width customly, only the height should be reduced to hide the empty space left by the qtablewidget.


    How can i do that? As far as i can see, no other layout options are available, and calling resize(..) and similar methods does not have any effect.



    have a great day.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: height/width resize issue

    You could try this to call resize(sizeHint()) after hiding the table.

    Or get the table's height, the layout's spacing, and the take the overall height, subtract the two values and resize to that.

    Cheers,
    __

  3. #3
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: height/width resize issue

    You could try to call adjustSize() on your dialog after hiding you QTableView

Similar Threads

  1. Pusbutton height and width
    By seany in forum Qt Programming
    Replies: 6
    Last Post: 7th June 2013, 06:35
  2. Widget Height and Width
    By in_dbasu in forum Qt Programming
    Replies: 3
    Last Post: 11th August 2011, 08:44
  3. Fix proportion of width and height in QGridLayout
    By Wong in forum Qt Programming
    Replies: 6
    Last Post: 7th January 2011, 07:24
  4. Replies: 2
    Last Post: 22nd January 2008, 16:10
  5. width and height of QTabWidget
    By chikkireddi in forum Qt Programming
    Replies: 6
    Last Post: 29th October 2007, 13:53

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.