Hi gertius,
just like Absum says

you always need a X11 window, which you have with your QMainQWindow basing on X11.
Since you are using QT it should be possible to do a MagellanSetWindow() with your QMainWindow's id (I'm sorry I haven't tried with Qt yet). You should then receive events in your Qt event loop, which you'll have to process like in xapp.c or the like.
This will save you this extra window solution you've now.
Maybe
this thread can give you a bit of an idea, although I assume its probably not what you're looking for.
Please let me know how things are developing or if I can you help any further!
Regards,
Christian