From 448bdf7bb40c767160be458e225ecb38dfd7973b Mon Sep 17 00:00:00 2001 From: zeljko Date: Sat, 24 Apr 2010 10:27:11 +0000 Subject: [PATCH] Qt: fixed TQtGroupBox items layout when clientrect needs interface update. git-svn-id: trunk@24870 - --- lcl/interfaces/qt/qtwidgets.pas | 21 ++++++++++++++++++++- lcl/interfaces/qt/qtwsextctrls.pp | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 4632e42244..0303b43628 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -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); diff --git a/lcl/interfaces/qt/qtwsextctrls.pp b/lcl/interfaces/qt/qtwsextctrls.pp index b85d3aebde..65707fa397 100644 --- a/lcl/interfaces/qt/qtwsextctrls.pp +++ b/lcl/interfaces/qt/qtwsextctrls.pp @@ -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);