How do I create a working indicator with Qt/C++?

You shouldn't use libappindicator for creating an Application Indicator in Qt programs. There's a better way!

If you have sni-qt installed that will automagically replace QSystemTrayIcon instances with the code for rendering that tray icon as a KDE Status Notifier Item, which the Application Indicator service will pick up and show in the Ubuntu menu bar.