As mentioned earlier, the KDE project does not mandate any single Open Source license as long as the license is Open Source. By far, the most common license for the KDE libraries is LGPL, and the most common for applications is GPL. Code that we may explicitly want people to incorporate into (possibly closed-source) applications may use other licenses.
The LGPL was designed by the FSF to ensure that the code, as written by the author, must always remain free. However, the library that the code is contained in may be used and linked by nonfree applications. You may sometimes see this referred to as a "copyleft" license.
Three questions often arise in regard to using libraries: "How may I use the library?";"May I use individual files from the library?"; and "May I modify the library?"
"How may I use the library?"
There are essentially no restrictions to using and linking to a LGPL library. Your project may be Open Source or closed source—commercial or not. However, this assumes that you are using the library as is, that you are not modifying it in any way, and that you are linking to it as a shared library. If any of those conditions aren't met, you must refer to the following questions.
"May I use individual files from the library?"
Yes, if you are careful. The files must be included in yet another shared library. You may not compile them directly into your application unless your application is licensed under the GPL. That is to say, all LGPL code that is removed from a library is automatically re-licensed under the GPL. If you insert this file into another shared library, you must ensure that this new library is licensed under the LGPL or GPL. In short, you may not ever insert a LGPL file into a nonfree application or library.
"May I modify the library?"
Yes, as long as you redistribute your modified library under the LGPL or GPL. If you make modifications but do not want to redistribute the entire library, or if you want to use a different license, you should treat your modifications as individual files and refer to the previous question.
Not only is the GPL the most popular license for KDE applications, but it is almost surely the most popular Open Source license anywhere. Probably the biggest reason for its popularity is that it is very effective in keeping your code free.
The GPL is another "copyleft" license (the original, in fact). Its design goal is to ensure that your code will not only always be free but furthermore, that it will never be used with a nonfree product. It is in that last clause that it differs from the LGPL. LGPL code, you may remember, does allow restricted usage by nonfree products.
You can use GPL code in a development sense in two major ways. Both options are briefly discussed next.
"May I use already written GPL code in my application?"
Yes, if your application is licensed under a GPL-compatible license. Note that just being an Open Source license isn't good enough—it must be "GPL compatible" as defined by the FSF. The FSF Web site has more information on this. In general, though, if your application is GPL, you shouldn't have problems including other GPL code (but see "The GPL Versus Qt War" section that follows).
"May I use already written GPL code in my library?"
Yes, if the library is GPL. If the library is LGPL, you must re-license it under the GPL or you may not include the GPL file. Note that if your library is GPL, it may not be used by nonfree applications.
"May I modify GPL code?"
Yes. If you intend to redistribute this code in another application or library, see the previous questions for help. If you redistribute the code in its own application, no problems exist at all.
If you have followed the KDE Project for any length of time, you have likely encountered "The GPL is not compatible with Qt" threads. The issues surrounding this are unfortunately quite ambiguous and highly open to interpretation. There has never been a court case involving the GPL, so all opinions have no solid legal basis. The argument is slightly different based on what version of Qt is involved. Specifically, the arguments have largely gone away with the release of Qt 2.2.
Qt 1.45 and earlier versions were covered under the FreeQt license. The FreeQt license was not an Open Source license. On one point, the GPL is quite clear: you may not mix GPL and nonfree code. That meant that the KDE project could not mix Qt code inside of the KDE libraries. Because the FreeQt license prohibited redistributing individual files from Qt, this was never a problem.
However, some free software advocates claimed that you could not link GPL code with nonfree libraries. They insisted that because KDE applications were GPL, they were in violation by linking with the nonfree Qt library. The Debian project refused to ship KDE with its distribution as a result. The KDE project has always maintained that those advocates have misinterpreted the GPL.
Qt 2.0 and Qt 2.1 are covered by the QPL. The QPL is an Open Source license, so it was expected that the problems would go away. Unfortunately, the FSF has indicated that although the QPL is Open Source, it doesn't consider it to be "GPL Compatible." The KDE project insists that it is.
This all became a moot point with the release of Qt 2.2. This and later versions of the free Qt are covered under a "dual" license. The author has a choice between using it as if it was covered under the QPL or under the GPL. This last clause was very important. All libraries and applications in KDE are compatible with the GPL. Therefore, when Qt is also covered under the GPL, all possible legal ambiguity drops away. From this point, all objections by the Free Software Foundation and the Debian Project essentially just went away.
Here are the standard questions:
"Which license for Qt should I use?"
It depends on what license you are using for your application. If you are using the GPL, then you will choose to license Qt under the GPL as well. If you are using Artistic, then you will want to choose the QPL (the Artistic license is not compatible with the GPL). If you are using BSD or MIT or similar, then it's up to you. As always, if your application is closed source, you must still purchase a Commercial license.
"May I use third-party GPL code in my application?"
Absolutely. There was some legal ambiguity with regards to this in the previous versions of Qt, but all such ambiguity is now gone.
This is a good time to mention that you should probably ask the author for permission even if there is no question on licenses. Asking permission is a common courtesy that Open Source developers usually grant each other. Legally, you may use or even distribute modified versions without permission, but it's considered a hostile act and it's almost never worth the grief that results from doing it.