In QtDesigner I've created QFrame with horizontal layout (layoutSpacing is 5). There are 3 QLineEdit widgets in it, with fixed size and horizontal spacer with expanding size(so when frame size is changed only spacer is changed)
Lets say initial size of lineEdits was 100x30. I need to change size of lineEdit widgets and I do that from code like this:
self.__ui.lineEdit1.resize(40, 30)
self.__ui.lineEdit2.resize(140, 30)
self.__ui.lineEdit3.resize(80, 30)
Their size is changed but their X position is not so I get big space between first two (65), and lineEdit2 is below lineEdit3.
Should I update layout or Frame somehow? I've tried layout.setSpacing(5) before and after mentioned code but in that case size of lineEdit is not changed (it's initial 100 again)
EDIT here is screenshot (I've edited in paint :D) as Qurban requested: 
resizeis called? - qurbansetFixedSize()instead ofresize()everytime you want to resize the widgets, as ekhumoro suggested in his answer. This solution meets your requirements. - qurban