Qt: set tristate handling (allowgrayed) on TQtCheckBox. part of #20740

git-svn-id: trunk@33751 -
This commit is contained in:
zeljko 2011-11-24 08:59:12 +00:00
parent 37f6b6943c
commit efd91117a1
2 changed files with 8 additions and 0 deletions

View File

@ -637,6 +637,7 @@ type
public
function CheckState: QtCheckState;
procedure setCheckState(state: QtCheckState);
procedure setTriState(AAllowGrayed: Boolean);
public
procedure AttachEvents; override;
procedure DetachEvents; override;
@ -5937,6 +5938,11 @@ begin
QCheckBox_setCheckState(QCheckBoxH(Widget), state);
end;
procedure TQtCheckBox.setTriState(AAllowGrayed: Boolean);
begin
QCheckBox_setTristate(QCheckBoxH(Widget), AAllowGrayed);
end;
procedure TQtCheckBox.AttachEvents;
begin
inherited AttachEvents;

View File

@ -1175,6 +1175,7 @@ begin
//enclose the call between Begin/EndUpdate to avoid send LM_CHANGE message
QtCheckBox := TQtCheckBox(ACustomCheckBox.Handle);
QtCheckBox.BeginUpdate;
QtCheckBox.setTriState(ACustomCheckBox.AllowGrayed);
case NewState of
cbGrayed: QtCheckBox.setCheckState(QtPartiallyChecked);
cbChecked: QtCheckBox.setCheckState(QtChecked);
@ -1196,6 +1197,7 @@ var
QtCheckBox: TQtCheckBox;
begin
QtCheckBox := TQtCheckBox.Create(AWinControl, AParams);
QtCheckBox.setTriState(TCustomCheckBox(AWinControl).AllowGrayed);
QtCheckBox.AttachEvents;
Result := TLCLIntfHandle(QtCheckBox);