re-write in Qt