changeset 31:d586244177ff

Fixes #244: Create "New Unit" dialog in Qt# app * Make new unit dialog unit type list use double-click on list
author IBBoard <dev@ibboard.co.uk>
date Sat, 07 Aug 2010 13:34:05 +0000
parents 56771b8efdaf
children e405b43a405b
files NewUnitDialog.cs
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/NewUnitDialog.cs	Wed Aug 04 19:37:23 2010 +0000
     1.2 +++ b/NewUnitDialog.cs	Sat Aug 07 13:34:05 2010 +0000
     1.3 @@ -33,6 +33,7 @@
     1.4  			}
     1.5  			
     1.6  			QObject.Connect(layout.unitTypeList, SIGNAL("currentRowChanged(int)"), UnitTypeSelectionChanged);
     1.7 +			QObject.Connect(layout.unitTypeList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), UnitTypeDoubleClicked);
     1.8  			SetOkayButtonState(false);
     1.9  		}
    1.10  
    1.11 @@ -41,14 +42,32 @@
    1.12  			SetOkayButtonState(layout.unitTypeList.CurrentRow != -1);
    1.13  		}
    1.14  		
    1.15 +		private void UnitTypeDoubleClicked()
    1.16 +		{
    1.17 +			QPushButton button = OkayButton;
    1.18 +			
    1.19 +			if (button.Enabled)
    1.20 +			{
    1.21 +				button.Click();
    1.22 +			}
    1.23 +		}
    1.24 +		
    1.25  		public UnitType SelectedUnit
    1.26  		{
    1.27  			get { return units[layout.unitTypeList.CurrentRow]; }
    1.28  		}
    1.29  
    1.30 +		private QPushButton OkayButton
    1.31 +		{
    1.32 +			get
    1.33 +			{
    1.34 +				return layout.buttonBox.Button(QDialogButtonBox.StandardButton.Ok);
    1.35 +			}
    1.36 +		}
    1.37 +
    1.38  		private void SetOkayButtonState(bool boolValue)
    1.39  		{
    1.40 -			layout.buttonBox.Button(QDialogButtonBox.StandardButton.Ok).Enabled = boolValue;
    1.41 +			OkayButton.Enabled = boolValue;
    1.42  		}
    1.43  	}
    1.44  }