diff --git a/lcl/interfaces/qt5/qtpagecontrol.inc b/lcl/interfaces/qt5/qtpagecontrol.inc index 87487148c2..46e1b2580e 100644 --- a/lcl/interfaces/qt5/qtpagecontrol.inc +++ b/lcl/interfaces/qt5/qtpagecontrol.inc @@ -185,107 +185,6 @@ begin end; end; -class function TQtWSCustomTabControl.GetDefaultClientRect( - const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer; - var aClientRect: TRect): boolean; -var - dx, dy: integer; - ATabWidget: TQtTabWidget; - ASize: TSize; - HSpace: Integer; - Overlap: Integer; - VSpace: Integer; - BaseHeight: Integer; - TabOverLap: Integer; - ShiftVertical: Integer; -begin - Result := False; - if AWinControl.HandleAllocated then - begin - if TQtWidget(AWinControl.Handle).ChildOfComplexWidget <> ccwTTabControl then - begin - ATabWidget := TQtTabWidget(AWinControl.Handle); - if ATabWidget.testAttribute(QtWA_PendingResizeEvent) or not ATabWidget.testAttribute(QtWA_Mapped) then - begin - // we must recalculate aclientrect since we have pending resize event - // and clientrect won't be accurate.issue #21805 - Result := True; - dx := GetPixelMetric(QStylePM_DefaultFrameWidth, nil, ATabWidget.Widget); - // HSpace := GetPixelMetric(QStylePM_TabBarTabHSpace, nil, nil); - VSpace := GetPixelMetric(QStylePM_TabBarTabVSpace, nil, ATabWidget.Widget); - Overlap := GetPixelMetric(QStylePM_TabBarBaseOverlap, nil, ATabWidget.Widget); - TabOverLap := GetPixelMetric(QStylePM_TabBarTabOverlap, nil, ATabWidget.Widget); - BaseHeight := GetPixelMetric(QStylePM_TabBarBaseHeight, nil, ATabWidget.Widget); - ShiftVertical := GetPixelMetric(QStylePM_TabBarTabShiftVertical, nil, ATabWidget.Widget); - - // trigger sizing, do not remove - ATabWidget.TabBar.sizeHint(@ASize); - - if ATabWidget.getTabPosition in [QTabWidgetNorth, QTabWidgetSouth] then - begin - if TCustomTabControl(AWinControl).ShowTabs then - dy := ATabWidget.TabBar.getHeight - else - dy := 0; - - if (BaseHeight < ShiftVertical) then - begin - if (Overlap = 0) then - begin - BaseHeight := BaseHeight + TabOverLap; - dx := dx + (TabOverlap * 2); - end else - begin - BaseHeight := BaseHeight * 2; - dx := dx + BaseHeight; - end; - end; - - if (Overlap > VSpace) then - BaseHeight := BaseHeight * 2; - - if (VSpace > TabOverLap) then - dx := dx + Overlap; - - aClientRect := Rect(0, 0, - Max(0, aWidth - (BaseHeight * 2)), - Max(0, aHeight - dx - dy)); - end else - begin - if TCustomTabControl(AWinControl).ShowTabs then - dy := ATabWidget.TabBar.getWidth - else - dy := 0; - - VSpace := 0; - HSpace := 0; - - if BaseHeight < ShiftVertical then - VSpace := TabOverLap - BaseHeight; - if (Overlap < dx) then - begin - VSpace := OverLap; - if OverLap = 0 then - begin - VSpace := TabOverLap * 2; - HSpace := BaseHeight; - end; - end; - - aClientRect := Rect(0,0, - Max(0, aWidth - dx - dy - VSpace), - Max(0, aHeight - (dx + Overlap + VSpace + HSpace))); - end; - end; - end; - end else - begin - dx := GetPixelMetric(QStylePM_TabBarBaseHeight, nil, nil); - aClientRect := Rect(0,0, Max(0, aWidth - (dx * 2)), Max(0, aHeight - (dx * 2))); - Result := True; - end; -end; - class procedure TQtWSCustomTabControl.AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); var diff --git a/lcl/interfaces/qt5/qtwscomctrls.pp b/lcl/interfaces/qt5/qtwscomctrls.pp index 3a0a85569c..b35edc2a57 100644 --- a/lcl/interfaces/qt5/qtwscomctrls.pp +++ b/lcl/interfaces/qt5/qtwscomctrls.pp @@ -53,9 +53,6 @@ type published class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle; override; - class function GetDefaultClientRect(const AWinControl: TWinControl; - const {%H-}aLeft, {%H-}aTop, aWidth, aHeight: integer; var aClientRect: TRect - ): boolean; override; class procedure AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); override; class procedure MovePage(const ATabControl: TCustomTabControl; diff --git a/lcl/interfaces/qt6/qtpagecontrol.inc b/lcl/interfaces/qt6/qtpagecontrol.inc index 87487148c2..46e1b2580e 100644 --- a/lcl/interfaces/qt6/qtpagecontrol.inc +++ b/lcl/interfaces/qt6/qtpagecontrol.inc @@ -185,107 +185,6 @@ begin end; end; -class function TQtWSCustomTabControl.GetDefaultClientRect( - const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer; - var aClientRect: TRect): boolean; -var - dx, dy: integer; - ATabWidget: TQtTabWidget; - ASize: TSize; - HSpace: Integer; - Overlap: Integer; - VSpace: Integer; - BaseHeight: Integer; - TabOverLap: Integer; - ShiftVertical: Integer; -begin - Result := False; - if AWinControl.HandleAllocated then - begin - if TQtWidget(AWinControl.Handle).ChildOfComplexWidget <> ccwTTabControl then - begin - ATabWidget := TQtTabWidget(AWinControl.Handle); - if ATabWidget.testAttribute(QtWA_PendingResizeEvent) or not ATabWidget.testAttribute(QtWA_Mapped) then - begin - // we must recalculate aclientrect since we have pending resize event - // and clientrect won't be accurate.issue #21805 - Result := True; - dx := GetPixelMetric(QStylePM_DefaultFrameWidth, nil, ATabWidget.Widget); - // HSpace := GetPixelMetric(QStylePM_TabBarTabHSpace, nil, nil); - VSpace := GetPixelMetric(QStylePM_TabBarTabVSpace, nil, ATabWidget.Widget); - Overlap := GetPixelMetric(QStylePM_TabBarBaseOverlap, nil, ATabWidget.Widget); - TabOverLap := GetPixelMetric(QStylePM_TabBarTabOverlap, nil, ATabWidget.Widget); - BaseHeight := GetPixelMetric(QStylePM_TabBarBaseHeight, nil, ATabWidget.Widget); - ShiftVertical := GetPixelMetric(QStylePM_TabBarTabShiftVertical, nil, ATabWidget.Widget); - - // trigger sizing, do not remove - ATabWidget.TabBar.sizeHint(@ASize); - - if ATabWidget.getTabPosition in [QTabWidgetNorth, QTabWidgetSouth] then - begin - if TCustomTabControl(AWinControl).ShowTabs then - dy := ATabWidget.TabBar.getHeight - else - dy := 0; - - if (BaseHeight < ShiftVertical) then - begin - if (Overlap = 0) then - begin - BaseHeight := BaseHeight + TabOverLap; - dx := dx + (TabOverlap * 2); - end else - begin - BaseHeight := BaseHeight * 2; - dx := dx + BaseHeight; - end; - end; - - if (Overlap > VSpace) then - BaseHeight := BaseHeight * 2; - - if (VSpace > TabOverLap) then - dx := dx + Overlap; - - aClientRect := Rect(0, 0, - Max(0, aWidth - (BaseHeight * 2)), - Max(0, aHeight - dx - dy)); - end else - begin - if TCustomTabControl(AWinControl).ShowTabs then - dy := ATabWidget.TabBar.getWidth - else - dy := 0; - - VSpace := 0; - HSpace := 0; - - if BaseHeight < ShiftVertical then - VSpace := TabOverLap - BaseHeight; - if (Overlap < dx) then - begin - VSpace := OverLap; - if OverLap = 0 then - begin - VSpace := TabOverLap * 2; - HSpace := BaseHeight; - end; - end; - - aClientRect := Rect(0,0, - Max(0, aWidth - dx - dy - VSpace), - Max(0, aHeight - (dx + Overlap + VSpace + HSpace))); - end; - end; - end; - end else - begin - dx := GetPixelMetric(QStylePM_TabBarBaseHeight, nil, nil); - aClientRect := Rect(0,0, Max(0, aWidth - (dx * 2)), Max(0, aHeight - (dx * 2))); - Result := True; - end; -end; - class procedure TQtWSCustomTabControl.AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); var diff --git a/lcl/interfaces/qt6/qtwscomctrls.pp b/lcl/interfaces/qt6/qtwscomctrls.pp index c5db8532d4..5d4a9dee0e 100644 --- a/lcl/interfaces/qt6/qtwscomctrls.pp +++ b/lcl/interfaces/qt6/qtwscomctrls.pp @@ -51,9 +51,6 @@ type published class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle; override; - class function GetDefaultClientRect(const AWinControl: TWinControl; - const {%H-}aLeft, {%H-}aTop, aWidth, aHeight: integer; var aClientRect: TRect - ): boolean; override; class procedure AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); override; class procedure MovePage(const ATabControl: TCustomTabControl;