Nominate our 2022 Qt Champions!

Allow to close Mainwindow while One more Window is Open

  • Hi Team ,

    I have two form which I have to show. When one Mainwindow is running and i have to push button and Second window pops up So, at that time I am not able to close the mainwindow neither by right click on tray and not by directly closing using close button .

    So my requirement is to allow closing while second window is open.


  • @praveen0991kr

    What is the intention to open a new window for the second form? Wouldn't i be easier to just replace the first form when clicking on the button or did i get you wrong here?

  • Hi You are right but that is part of the software because Qmainwindow processing we cant stop ,
    and to so share and save some video file I have open Qdailog that will be open till the work done an then I am into QmainWidow . But in case I have to close Qmainwindow directly from close button while Qdialog is open how to do that , As QDialog window is open I am not able to click any button on Qmainwindow .

    So pls suggest something.


  • @praveen0991kr

    Make your dialog non-modal by using show() rather than exec(). Then you can click on other windows.

  • Hi Keith ,

    Thanks for your support yes it was a problem of Model So, Just before Show() I have called :


    And it was working like a charm !!

    Thanks & Regards
    Praveeen Kumar

  • @praveen0991kr

    According the documentation of QDialog Modal Property , it should not be neccessary to setModal(false) because it is default.

Log in to reply