The advice squidge gave you is very good.
But that code also uses some technical stuff you don't need to use, since that file is meant to be auto-generated and you are not supposed to write code just like UIC and then integrate it with the rest of your project using one of these methods
So basically that file includes some tricks that allows the Qt programmers to keep separated the auto-generated code from the code they write.

So i would like to add that the advice squidge gave you is for those somehow advanced C++ programmers.
If you are experienced with C++ you can easy understand that file, and you can get inspiration form there, don't forget that

The recommended reading for those new to Qt layouts is this
Also documentation for signals and slots