Qt,Qt5,Qt6: initialize scroll offset when handle is created. issue #41513

(cherry picked from commit c0f4946828)

Co-authored-by: zeljan1 <zeljko@holobit.hr>
This commit is contained in:
Željan Rikalo 2025-04-07 21:15:14 +02:00 committed by Željan Rikalo
parent 651963c199
commit e54a83fb6e
3 changed files with 21 additions and 0 deletions

View File

@ -6723,6 +6723,13 @@ begin
inherited AttachEvents;
FViewPortEventHook := QObject_hook_create(viewportWidget);
QObject_hook_hook_events(FViewPortEventHook, @ScrollViewEventFilter);
if (LCLObject is TScrollingWinControl) then
begin
if TScrollingWinControl(LCLObject).VertScrollBar.Visible then
FScrollY := -TScrollingWinControl(LCLObject).VertScrollBar.Position;
if TScrollingWinControl(LCLObject).HorzScrollBar.Visible then
FScrollX := -TScrollingWinControl(LCLObject).HorzScrollBar.Position;
end;
end;
function TQtWindowArea.CanAdjustClientRectOnResize: Boolean;

View File

@ -7019,6 +7019,13 @@ begin
inherited AttachEvents;
FViewPortEventHook := QObject_hook_create(viewportWidget);
QObject_hook_hook_events(FViewPortEventHook, @ScrollViewEventFilter);
if (LCLObject is TScrollingWinControl) then
begin
if TScrollingWinControl(LCLObject).VertScrollBar.Visible then
FScrollY := -TScrollingWinControl(LCLObject).VertScrollBar.Position;
if TScrollingWinControl(LCLObject).HorzScrollBar.Visible then
FScrollX := -TScrollingWinControl(LCLObject).HorzScrollBar.Position;
end;
end;
function TQtWindowArea.CanAdjustClientRectOnResize: Boolean;

View File

@ -6968,6 +6968,13 @@ begin
inherited AttachEvents;
FViewPortEventHook := QObject_hook_create(viewportWidget);
QObject_hook_hook_events(FViewPortEventHook, @ScrollViewEventFilter);
if (LCLObject is TScrollingWinControl) then
begin
if TScrollingWinControl(LCLObject).VertScrollBar.Visible then
FScrollY := -TScrollingWinControl(LCLObject).VertScrollBar.Position;
if TScrollingWinControl(LCLObject).HorzScrollBar.Visible then
FScrollX := -TScrollingWinControl(LCLObject).HorzScrollBar.Position;
end;
end;
function TQtWindowArea.CanAdjustClientRectOnResize: Boolean;