If linked against Qt Dbus, check for running notification server and send Freedesktop notification message to it instead of showMessage with the systray icon.
Set default action and listen for signal. If we get the signal, show and raise our window.
Doing it "by hand" with Qt DBus is probably not that bad for libnotify, actually.
Of course, just to make it even more complex GNOME has their own new notification DBus system that isn't considered stable yet but is more like what I want. Probably KDE will want something similar eventually, so I hope freedesktop spec just goes to a new version, but we'll see.
QSystemTrayIcon makes a reasonable fallback for notifications when we have no other plan.