# HG changeset patch # User IBBoard # Date 1281188045 0 # Node ID d586244177ffd6c0fee792e2f1a4f236ce178446 # Parent 56771b8efdafa2a1e71b913e8f4a095554f85e0a Fixes #244: Create "New Unit" dialog in Qt# app * Make new unit dialog unit type list use double-click on list diff -r 56771b8efdaf -r d586244177ff NewUnitDialog.cs --- a/NewUnitDialog.cs Wed Aug 04 19:37:23 2010 +0000 +++ b/NewUnitDialog.cs Sat Aug 07 13:34:05 2010 +0000 @@ -33,6 +33,7 @@ } QObject.Connect(layout.unitTypeList, SIGNAL("currentRowChanged(int)"), UnitTypeSelectionChanged); + QObject.Connect(layout.unitTypeList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), UnitTypeDoubleClicked); SetOkayButtonState(false); } @@ -41,14 +42,32 @@ SetOkayButtonState(layout.unitTypeList.CurrentRow != -1); } + private void UnitTypeDoubleClicked() + { + QPushButton button = OkayButton; + + if (button.Enabled) + { + button.Click(); + } + } + public UnitType SelectedUnit { get { return units[layout.unitTypeList.CurrentRow]; } } + private QPushButton OkayButton + { + get + { + return layout.buttonBox.Button(QDialogButtonBox.StandardButton.Ok); + } + } + private void SetOkayButtonState(bool boolValue) { - layout.buttonBox.Button(QDialogButtonBox.StandardButton.Ok).Enabled = boolValue; + OkayButton.Enabled = boolValue; } } }