This I temp resolved by deriving the ui classes from QMainWindow instead of QWidget.
Do you understand that QMainWindow is supposed to be the only top-level window in your app, and that there is only supposed to be one instance of that class? You now have THREE classes that are derived from QMainWindow. QMainWindow is not a magic bullet class that you can derive anything from just to achieve some desired UI effect (like a different background color). And showMaximized() should never be called on a child window, only on a top-level window like QMainWindow.
QMainWindow is not just a widget, it defines a framework and a set of behaviors for applications with a single top-level window and many child windows within it. You cannot just simply use a QMainWindow anywhere you want without running into problems somewhere along the line because you haven't followed the rules.
I have no idea what types of classes "RaptorLrsGUI" and "RaptorCoreGUI" are. If they aren't derived from QWidget, then that is an error. If you have a custom paintEvent() in these classes, then that is where you should implement the code to fill the background with whatever color you want. If you do not have a paintEvent(), then in the constructor for these classes you should have code like this:
QPalette pal
= palette
();
// retrieves the default palette for the widget, as defined by the app's style pal.
setColor( QPalette::Window, Qt
::white );
setPalette( pal );
setAutoFillBackground( true );
QPalette pal = palette(); // retrieves the default palette for the widget, as defined by the app's style
pal.setColor( QPalette::Window, Qt::white );
setPalette( pal );
setAutoFillBackground( true );
To copy to clipboard, switch view to plain text mode
Setting the appropriate colors in the palette as well as ensuring that the widget automatically clears its background and fills it with the chosen color on a paintEvent() is the right way to do it.
I think you need to take a step back and look at some of the many examples in Qt for QMainWindow-based apps. If you continue down the path you are taking, your PoC is going to turn out to be a "proof of buggy code" that acts in ways you can't explain and is confusing to debug.
Bookmarks