simplify code. fix a qt4-static compile