[SOLVED] QGridLayout: widget takes too much space
-
I've met a problem that QToolBar takes way too much space on my layout so other widgets are moved too far from the place where they should be. I've tried SetMaximumSize(), SetFixedSize() and so on and none works. Yes, I've read post describing why QGridLayout has no "MaximumSize" property, although I've read a lot of other posts and nothing helps... Could you give me an advice please?
!http://img20.imageshack.us/img20/1684/toolbarj.png(some illustration)! -
Honestly, I don't quite get your example, but I'll try it anyway: you have a QGridLayout, consisting of several widgets left and right of a QToolBar, which keeps growing larger then it has to be.
Well, this is due to the fact that the default size policy for QToolBar is Preferred, which basically means that QToolBar might expand if there is additional space, although it doesn't benefit from doing so.
Just set the size policy to Maximum, which prevents the QToolBar from exceeding its absolutely minimum dimensions.