Yeah, it's enough change the stacking order once. Somewhere near creating the widgets is fine.
So if MyClass is the parent, anything it draws (the red text) appears below it's children. Each widget is responsible for drawing itself when it receives a paint event. You don't paint other widgets, like children in the paintEvent() of the parent. Where is the textDisplay widget in the screenshot? Maybe you have to call QWidget::adjustSize() or something to make it adjust it's size to correspond it's contents (this would be done automatically if it was in a layout).The QLabel textDisplay is a member of MyClass. In the constructor of MyClass, I create the widgets that are shown as black in the screenshot (Bus, Prozessor etc.) and arrange them in a layout. So that makes them child widgets - right? The textDisplay is not integrated into the layout.
The one widget that is supposed to move around is textDisplay, so it is the only one that gets drawn in the paintEvent() method.






Reply With Quote
Bookmarks