First of all: If you install software the way it's supposed to be done on Ubuntu, namely by using software center, synaptic, muon, aptitude, apt-get, or any other dpkg-frontend, these programs will install all required dependencies automatically. My suggestion is therefore, to use one of the mentioned programs (I'd use synaptic, but many people prefer Software Center) and search if the program you want to install is listed there. If yes, install the version from software center, because this will give you automatic updates and an easy way to uninstall it. Also, as said, all required dependencies will be installed automatically, what saves you a bunch of work when installing programs with lots of dependencies.
Now to answer your question in case the program you want to install is not available in the Ubuntu repositories and therefore does not appear in Software Center: In order to get a more or less complete installation of Qt with all the fancy modular stuff (gui, xml, sql,...), open Synaptic, or Software Center, or Muon, or aptitude, or whatever dpkg-frontend you want to use, and search for "libqt4-dev". In case you are using Software Center, you might need to tell it to "show technical items" (in the status bar at the bottom of the window) to get the result displayed. Install the package libqt4-dev, and you should be fine. This should not only install all relevant Qt libraries, but also the development headers that you might need if the guide you are following requires you to compile the program yourself.
If you want to use the command line instead of a GUI tool, simply run
sudo apt-get install libqt4-dev