You may have another option.
You can also add widgets
in your .pro
file like
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
By adding this line in .pro
file, Now you just no need to worry about Qt version and include file like <QtGui/QMainWindow>
or <QtWidgets/QMainWindow>
Hope it will useful to you.