Automatically switch editor layout when assigning .ui file
Fix #7286