Hi, this is old now but in case someone else finds this:
I managed to solve this problem by using
setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
for a layout holding the QLineEdit widget. Actually it wasn't the layout holding the widget, but the layout holding that layout, so you may need to experiment to find out where you need to make this update (or just use SetNoConstraint for all your layouts)
I hope this helps someone!