I'm using Lubuntu 16.04, in a x64 machine. The icon appears in the menu launcher (not initially, after installing kate5-data), but not in the program itself. Reproducible: Always Steps to Reproduce: 1. Just open Kwrite, the icon appearing in the window title bar is the default blank window of Qt. Actual Results: There is a default icon instead of the app's icon. Expected Results: The app's icon appearing in the window border. There is no workaround a know of, but it is just a stetic problem.
This seems to be fixed in 16.08.
FWIW, the correct cross-platform way of getting the icon to show up in task switchers, Docks etc. is something along the lines of app.setWindowIcon(QIcon::fromTheme("appIconName", app.windowIcon())); this avoids replacing the application icon (resource) installed in or with the application with an empty icon; as a general rule of thumb one can say that platforms either store the app icon resource with the app (OS X, MS Windows) or else they use an icon from a user-selectable icon theme from some central location.