I have a qt application which uses QGraphicsView and QGraphicsProxyWidget to rotate my widgets. Now I need to tell the system that my orientation has changed.
This can only be done by subclassing QWindow and do the following (view is a QWindow) [1]:

view.reportContentOrientationChange(Qt::LandscapeO rientation);
view.screen()->setOrientationUpdateMask(Qt::LandscapeOrientation );

QWindow is for me new so I was looking for an example and I found this [2].
Now I would like to know how to add widgets to this qwindow example.
I tried many things because I don't know a way to achieve this but was not successful.
Subclassing a qwindow is mostly done for gl or sdl stuff but not for widgets.

Qt Code:
  1. #include <QtWidgets>
  2. class MyWindow: public QWindow
  3. {
  4. public:
  5. MyWindow():
  6. m_update_pending(false)
  7. {
  8. m_backingStore = new QBackingStore(this);
  9. setTitle("QWindow Background Image");
  10. resize(300,250);
  11. }
  12.  
  13. bool event(QEvent *event)
  14. {
  15. if (event->type() == QEvent::UpdateRequest)
  16. {
  17. m_update_pending = false;
  18. renderNow();
  19. return true;
  20. }
  21. return QWindow::event(event);
  22. }
  23.  
  24. void renderLater()
  25. {
  26. if (!m_update_pending)
  27. {
  28. m_update_pending = true;
  29.  
  30. //Post this event to event queue for later processing
  31. QCoreApplication::postEvent(this,
  32. new QEvent(QEvent::UpdateRequest));
  33. }
  34. }
  35.  
  36. void resizeEvent(QResizeEvent *resizeEvent)
  37. {
  38. m_backingStore->resize(resizeEvent->size());
  39. if (isExposed())
  40. {
  41. renderNow();
  42. }
  43. }
  44.  
  45. void exposeEvent(QExposeEvent *)
  46. {
  47. if (isExposed())
  48. {
  49. renderNow();
  50. }
  51. }
  52.  
  53. void renderNow()
  54. {
  55. if (!isExposed())
  56. return;
  57.  
  58. QRect rect(0, 0, width(), height());
  59. m_backingStore->beginPaint(rect);
  60.  
  61. QPaintDevice *device = m_backingStore->paintDevice();
  62. QPainter painter(device);
  63.  
  64. painter.drawPixmap(rect,QPixmap("background.jpg"));
  65. painter.drawText(QRectF(0, 0, width(), height()),
  66. Qt::AlignCenter, QStringLiteral("QWindow"));
  67.  
  68. m_backingStore->endPaint();
  69. m_backingStore->flush(rect);
  70. }
  71.  
  72. private:
  73. QBackingStore *m_backingStore;
  74. bool m_update_pending;
  75. };
  76.  
  77. int main(int argc, char *argv[])
  78. {
  79. QApplication app(argc, argv);
  80.  
  81. MyWindow window;
  82. window.show();
  83.  
  84. return app.exec();
  85. }
To copy to clipboard, switch view to plain text mode 

Do I need to use a window container? What would be the best way? I have no clue, no starting point, I am lost.
I would be very happy if someone could make a small example showing a qpushbutton or some other widget on that window.
Other hints and tips are also welcome.

[1]:https://lists.sailfishos.org/piperma...ly/004833.html
[2]:http://codeprogress.com/cpp/librarie...ackgroundImage