Fix build without QtWidgets.

In that case we don't traverse ui/, so CMake fails when trying to access
properties on that folder.