I'd see what WM_* message(s) are being sent. Specifically WM_DISPLAYCHANGE, WM_FONTCHANGE, etc.
Qt is probably initializing correctly, then when WM_DISPLAYCHANGE happens, they get reset back to defaults, without picking up Qt's customizations. If you can identify the message, you can filter it out. > Sent: Wednesday, December 02, 2015 at 6:05 AM > From: maitai <mai...@virtual-winds.org> > To: Interest@qt-project.org > Subject: Re: [Interest] application appearance changing when laptop goes in > saving energy mode > > Hello, > > Still searching to fix that one. > > I can now reproduce it at leasure: If I connect my laptop to an external > monitor, launch the application, then unplug the external monitor and > hover the mouse on the windows bar to make it appear (autohide is > activated), my application AND QtCreator changes font, palette and > style. > > Then only way to get normal look back is to restart application. > Reloading style, stylesheet, palette and font at application level does > not fix existing widgets once they are corrupted. > > I cannot find what trigger this, nor at qApp's event level or at > QMainWindow level or at widget's level. > > I am using qt 5.5.1 on windows 10. It does not seem to occur on Windows > 7 as far as I can tell. > > I have users complaining about that too so it is not just me ;) > > Any idea how to catch what is causing that and avoid it? Since it occurs > also in QtCreator maybe I should open a bug report... > > Thanks > Philippe Lelong > > > Le 09-11-2015 16:45, maitai a écrit : > > Thanks Robert for your reply, > > > > In fact I succeeded to reproduce partly the problem. I have a laptop > > with 2 graphic cards, switchable. Whenever the PC goes in power-saving > > mode, it switches to the intel one. When this happens, my menubar > > (regular QMenuBar) is changing font and becomes ugly, and the only way > > to get it back to normal is to restart the application. It seems to > > happen also from time to time if I switch from external monitor to > > laptop monitor. > > > > This app is not using opengl, it's just a plain QWidget app. > > > > No signal or event as far as I can see is triggered when this happens, > > just a paintEvent it seems. > > > > The funny thing is that even QtCreator is impacted by that... It also > > changes font or style. > > > > Any clue on what is going on there? > > > > Thanks > > Philippe Lelong > > > > Le 09-11-2015 12:03, Robert Iakobashvili a écrit : > >> On Mon, Nov 9, 2015 at 7:54 AM, maitai <mai...@virtual-winds.org> > >> wrote: > >>> > >>> Hello > >>> > >>> On Windows, some users are reporting that the application style > >>> (font? palette?) is changing when laptop goes in energy saving mode, > >>> and becomes more or less unreadable (white font on white background, > >>> etc). I have seen that myself also a couple of times but I'm unable > >>> to reproduce it. > >>> > >>> When it occurs, putting the laptop back on power does not fix > >>> anything, and the only way to get back the proper appearance is to > >>> restart the application. If you start the application when in battery > >>> saving mode, no problem. The application is widget-based > >>> (QMainWindow, QGraphicalScene, QMenubar, etc), Qt is 5.5.1 but that > >>> was reported also with previous Qt versions. > >>> > >>> As I said this occurs only for a few users, and I cannot reproduce > >>> it. Maybe it's connected with the laptop changing GPU, I don't know. > >>> > >>> Does anyone knows what could possibly trigger this, and if I can > >>> catch it somehow either to avoid it or reload style/palette/font/etc > >>> when it occurs? > >>> > >>> Thanks > >>> Philippe Lelong > >> > >> > >> Hi, > >> > >> With which options Qt was configured and built? > >> > >> Any plugins your software is using? > >> > >> Is it correlating with any particular Windows versions > >> like on Windows-10 or 8.1? > >> > >> That sounds like an aggressive memory optimization by OS. > >> Locking in memory sometimes could help against. > >> > >> There is a Qt signal > >> > >> QGuiApplication::on_applicationStateChanged(Qt::ApplicationState > >> state); > >> > >> and using it on Android. > >> > >> Perhaps, coming to the state:Qt::ApplicationActive from > >> somewhere else and reloading fonts, etc could be a work-around? > >> > >> Kind regards, > >> Robert > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest