Fix key input
1. Remove Qt specific loigc; 2. Move layout logic out of LineInfos