I'm also faced this problem. I searched over all internet and tried all possible combinations. Nothing helped. Such topics usually end with no solution or with words like MasterBLB said: "It must work automatically !" But solution proposed by MasterBLB works, oddly enough. I did some experiments trying to reproduce it and found two partial solutions:
1. Place at least one spacer on preferred side of button in layout. (Either spacers on both sides for central alignment.) It will give space for growing but limits with parent widget boundaries finally.
2. Place button directly in layout of topmost-level widget (i.e. QMainWindow or QDialog). Or you can place it in layout which belongs to nested layouts up to the topmost-level widget. That widget must be resizeable, of course.
I have no explanations for themThese are best I found until now. If somebody have better ones, please share your knowledge.
![]()
Bookmarks