[Solved] QMainWindow show/hide

  • Hi all,

    In an application I am developing I have implemented a tray icon. The close action is overriden to minimize to tray and from the icon tray one can restore the window.
    I use hide() to hide the window when I minimize the window to tray and show() to make it appear again after the tray icon is clicked. It works fine but there seems to be a side-effect I don't like. When the window is shown again the window constructor is called executing a lot of code that should not be executed. Is there a way to avoid this?

    edit: By the way setVisible() has exactly the same effect

    edit 2: My bad, I forgot I had overriden the showEvent. Sorry for spamming with stupid question.

  • I'm using same thing here and there's no constructor calling after re-show - everything works as expected.IMO, without provided code nobody can help you in this case.
    btw. I'm talking about linux (x11).

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.