Qt: fixed TQtGroupBox items layout when clientrect needs interface update.

git-svn-id: trunk@24870 -
This commit is contained in:
zeljko 2010-04-24 10:27:11 +00:00
parent eb0db3e8f4
commit 448bdf7bb4
2 changed files with 23 additions and 2 deletions

View File

@ -52,7 +52,9 @@ type
TChildOfComplexWidget = (ccwNone,
ccwComboBox,
ccwTreeWidget);
TQtGroupBoxType = (tgbtNormal,
tgbtCheckGroup,
tgbtRadioGroup);
// records
TPaintData = record
PaintWidget: QWidgetH;
@ -557,6 +559,7 @@ type
TQtGroupBox = class(TQtWidget)
private
FGroupBoxType: TQtGroupBoxType;
procedure setLayoutThemeMargins(ALayout: QLayoutH; AWidget: QWidgetH);
protected
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
@ -566,6 +569,7 @@ type
function getText: WideString; override;
procedure setText(const W: WideString); override;
procedure setFocusPolicy(const APolicy: QtFocusPolicy); override;
property GroupBoxType: TQtGroupBoxType read FGroupBoxType write FGroupBoxType;
end;
{ TQtToolBar }
@ -4975,6 +4979,7 @@ begin
{$ifdef VerboseQt}
WriteLn('TQtGroupBox.Create ');
{$endif}
FGroupBoxType := tgbtNormal;
FHasPaint := True;
if AParams.WndParent <> 0 then
Parent := TQtWidget(AParams.WndParent).GetContainerWidget
@ -5001,6 +5006,9 @@ end;
function TQtGroupBox.EventFilter(Sender: QObjectH; Event: QEventH): Boolean;
cdecl;
var
ResizeEvent: QResizeEventH;
NewSize, OldSize: TSize;
begin
Result := False;
QEvent_accept(Event);
@ -5014,6 +5022,17 @@ begin
begin
LCLObject.DoAdjustClientRectChange(False);
SlotShow(True);
{send dummy LM_SIZE to LCL}
if LCLObject.ClientRectNeedsInterfaceUpdate then
begin
OldSize.cx := LCLObject.Height;
OldSize.cy := LCLObject.Width;
NewSize := OldSize;
inc(OldSize.cx);
inc(OldSize.cy);
ResizeEvent := QResizeEvent_create(@NewSize, @OldSize);
QCoreApplication_postEvent(Widget, ResizeEvent, -1);
end;
end;
else
Result := inherited EventFilter(Sender, Event);

View File

@ -456,6 +456,7 @@ var
Str: WideString;
begin
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
QtGroupBox.GroupBoxType := tgbtRadioGroup;
Str := GetUtf8String(AWinControl.Caption);
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
@ -481,7 +482,8 @@ var
Str: WideString;
begin
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
QtGroupBox.GroupBoxType := tgbtCheckGroup;
Str := GetUtf8String(AWinControl.Caption);
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);