Modified to support qt5