removed some duplicate code in qtMainWindow