PDA

View Full Version : height/width resize issue



tuli
29th September 2014, 18:08
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.

anda_skoa
29th September 2014, 19:49
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,
__

golubevsv
30th September 2014, 11:31
You could try to call adjustSize() on your dialog after hiding you QTableView