KDE4 Porting Gotchas

Besides the big stuff of adjusting to Qt4 and a slightly difference KDE4 API for the port of Tellico to the KDE platform, I’ve hit a few gotchas that took me some time to figure out. These happen after everything compiles, but when something doesn’t seem to work quite right. They’re mentioned on the KDE4 Porting guidelines, but are easy to miss.

  • KSaveFile and KTemporaryFile must be open()’ed before you use them, and the file name itself gets cleared when you close() them. That took me a long time to track down.
  • KUrl::directory(false) will compile, but trigger a big assert, since the function signature has changed to use enum’s.
  • You must call QXmlInputSource::setData before a QXmlReader uses it, even if the data is empty. This one took me a while to figure out.

I’ll add to this list as I come across new ones.