Qt: improved TQtGroupBox, added ability to show/hide checkbox in title of TQtGroupBox, needed by 3rd party components.

git-svn-id: trunk@47673 -
This commit is contained in:
zeljko 2015-02-10 12:09:10 +00:00
parent d5cd72c855
commit 40d96c7e79

View File

@ -739,6 +739,10 @@ type
private
FGroupBoxType: TQtGroupBoxType;
FCWEventHook: QObject_hookH;
function GetCheckBoxState: boolean;
function GetCheckBoxVisible: boolean;
procedure SetCheckBoxState(AValue: boolean);
procedure SetCheckBoxVisible(AValue: boolean);
procedure setLayoutThemeMargins(ALayout: QLayoutH; AWidget: QWidgetH);
protected
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
@ -754,6 +758,8 @@ type
procedure setText(const W: WideString); override;
procedure setFocusPolicy(const APolicy: QtFocusPolicy); override;
property GroupBoxType: TQtGroupBoxType read FGroupBoxType write FGroupBoxType;
property CheckBoxState: boolean read GetCheckBoxState write SetCheckBoxState;
property CheckBoxVisible: boolean read GetCheckBoxVisible write SetCheckBoxVisible;
end;
{ TQtToolBar }
@ -7614,6 +7620,27 @@ begin
end;
end;
function TQtGroupBox.GetCheckBoxVisible: boolean;
begin
Result := QGroupBox_isCheckable(QGroupBoxH(Widget));
end;
function TQtGroupBox.GetCheckBoxState: boolean;
begin
Result := CheckBoxVisible and QGroupBox_isChecked(QGroupBoxH(Widget));
end;
procedure TQtGroupBox.SetCheckBoxState(AValue: boolean);
begin
if CheckBoxVisible then
QGroupBox_setChecked(QGroupBoxH(Widget), AValue);
end;
procedure TQtGroupBox.SetCheckBoxVisible(AValue: boolean);
begin
QGroupBox_setCheckable(QGroupBoxH(Widget), AValue);
end;
function TQtGroupBox.CreateWidget(const AParams: TCreateParams): QWidgetH;
var
Layout: QBoxLayoutH;