examples/widgets/mainwindows/application#

(You can also check this code in the repository)