You never have to publish (i.e. making it public to everyone) your code. At least that depends on the mode of distribution.
The GPL only places requirements on you when you give your software to someone else. Everyone who receives your software is also eligible to your source code (under GPL, not under LGPL). So, if you give your software to one or two people you also have to give them the source code. If they decide to further give the software to somebody else, they also have to provide the source code to those people. If you put up your software for everyone to download on the internet, then you need to actually publish your source code. This all only applies to GPL. LGPL only means that this applies to the library (Qt in this particular case) and not your own source code. Also, you can provide a written offer valid for at least three? months to provide the source code to everyone who receives your software instead of giving them the source code directly.
Everything that is private and stays private does not have any requirements on the source code.