Reputation: 1827
I am writing an application in qt. This application will have many dialogs. My question is: what is the strategy with dialog handling? Should I create them in the constructor of the main window or shouold they be created when the user click on buttons (that is when the user need it). Should they be destroyed or they are automatically destroyed?
Upvotes: 1
Views: 111
Reputation: 22366
There is no hard rule to this. Generally dialogs are small and light, and therefore are created when opened and destroyed (usually automatically) when closed. However, if you have a custom dialog that contains very heavy widgets and/or needs to get data from a slow source, then you can create a dialog and only show when it when required.
Should they be destroyed or they are automatically destroyed?
This depends entirely on how you create it. The best I can do is point you to the most informative source.
Upvotes: 1