Unify the widget layout code with 'setItemLayout'