Sample code from Advanced Qt Programming book ported to Qt 5.3.x