Mercurial > repos > IBBoard.WarFoundry.GUI.QtSharp
diff MainWindow.cs @ 26:55d4f16c982b
Fixes #250: QtSharp app doesn't always quit properly
* Override Close event to dispose of file dialogs (open and save)
* Remove unnecessary event handler hooked to close
* Change app initialisation to match pattern used by Synapse
* Create file dialogs without specifying "this" as parent - seems to be main fix, for some reason.
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 31 Jul 2010 16:03:14 +0000 |
parents | 9641addafffe |
children | 5ee15def17e7 |
line wrap: on
line diff
--- a/MainWindow.cs Sat Mar 06 15:23:40 2010 +0000 +++ b/MainWindow.cs Sat Jul 31 16:03:14 2010 +0000 @@ -47,11 +47,11 @@ } SetAppTitle(); - saveArmyDialog = new QFileDialog(this); + saveArmyDialog = new QFileDialog(); saveArmyDialog.acceptMode = QFileDialog.AcceptMode.AcceptSave; saveArmyDialog.fileMode = QFileDialog.FileMode.AnyFile; saveArmyDialog.SetDirectory(new QDir(Environment.GetFolderPath(Environment.SpecialFolder.Personal))); - openArmyDialog = new QFileDialog(this); + openArmyDialog = new QFileDialog(); openArmyDialog.acceptMode = QFileDialog.AcceptMode.AcceptOpen; openArmyDialog.fileMode = QFileDialog.FileMode.ExistingFile; openArmyDialog.SetNameFilter("*.army"); @@ -64,6 +64,13 @@ CommandStack.CommandStackUpdated+= HandleCommandStackCommandStackUpdated; } + protected override void CloseEvent(QCloseEvent arg1) + { + base.CloseEvent(arg1); + saveArmyDialog.Dispose(); + openArmyDialog.Dispose(); + } + private void SetUpActionIcons() { layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png");