Updated code so that it can be compiled under both QT 4 and QT 5.