mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 19:09:26 +02:00
marge r50991 #b61461e71a,r50994,r51003:
LCL: fixed infinite loop and crash with TScrollingWinControl. issue #29194 LCL: add support of scrolling invisible window. issue #29194 Qt: keep track of scrolled offset when viewport is not visible. issue #29239 git-svn-id: branches/fixes_1_6@51007 -
This commit is contained in:
parent
aa802ffa10
commit
02da6304e8
lcl
@ -73,6 +73,7 @@ begin
|
||||
PrevPosition := FPosition;
|
||||
// position has to be set before FControl.ScrollBy !!!
|
||||
FPosition := Value;
|
||||
|
||||
// scroll logical client area of FControl
|
||||
if Kind = sbVertical then
|
||||
FControl.ScrollBy(0, PrevPosition - FPosition)
|
||||
|
@ -6136,10 +6136,10 @@ end;
|
||||
|
||||
procedure TWinControl.ScrollBy_WS(DeltaX, DeltaY: Integer);
|
||||
begin
|
||||
if HandleAllocated and IsWindowVisible(Handle) then
|
||||
if HandleAllocated then
|
||||
TWSWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY)
|
||||
else
|
||||
ScrollBy(DeltaX, DeltaY);
|
||||
raise Exception.Create('TWinControl.ScrollBy_WS: Handle not allocated');
|
||||
end;
|
||||
|
||||
procedure TWinControl.ScrollBy(DeltaX, DeltaY: Integer);
|
||||
|
@ -473,9 +473,14 @@ type
|
||||
{ TQtViewPort }
|
||||
|
||||
TQtViewPort = class(TQtWidget)
|
||||
private
|
||||
{when our viewport is invisible then we must keep track of scrolling. issue #29239}
|
||||
FInvisibleX: integer;
|
||||
FInvisibleY: integer;
|
||||
public
|
||||
function CanPaintBackground: Boolean; override;
|
||||
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
|
||||
procedure InitializeWidget; override;
|
||||
procedure scroll(dx, dy: integer; ARect: PRect = nil); override;
|
||||
procedure stackUnder(AWidget: QWidgetH); override;
|
||||
end;
|
||||
@ -16085,6 +16090,18 @@ begin
|
||||
' Event=', EventTypeToStr(Event),' inUpdate=',inUpdate);
|
||||
{$endif}
|
||||
case QEvent_type(Event) of
|
||||
QEventShow,
|
||||
QEventShowToParent:
|
||||
begin
|
||||
{Qt does not track scrolled offset of widget when it''s not visible.issue #29239}
|
||||
if (FInvisibleX <> 0) or (FInvisibleY <> 0) then
|
||||
begin
|
||||
QWidget_scroll(Widget, FInvisibleX, FInvisibleY);
|
||||
FInvisibleX := 0;
|
||||
FInvisibleY := 0;
|
||||
end;
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
QEventResize:
|
||||
begin
|
||||
// immediate update clientRect !
|
||||
@ -16167,9 +16184,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtViewPort.InitializeWidget;
|
||||
begin
|
||||
FInvisibleX := 0;
|
||||
FInvisibleY := 0;
|
||||
inherited InitializeWidget;
|
||||
end;
|
||||
|
||||
procedure TQtViewPort.scroll(dx, dy: integer; ARect: PRect = nil);
|
||||
begin
|
||||
inherited scroll(dx, dy, ARect);
|
||||
if not getVisible then
|
||||
begin
|
||||
FInvisibleX += dx;
|
||||
FInvisibleY += dy;
|
||||
end else
|
||||
inherited scroll(dx, dy, ARect);
|
||||
FScrollX := FScrollX + dx;
|
||||
FScrollY := FScrollY + dy;
|
||||
end;
|
||||
|
@ -590,7 +590,7 @@ end;
|
||||
class procedure TWin32WSWinControl.ScrollBy(const AWinControl: TWinControl;
|
||||
DeltaX, DeltaY: integer);
|
||||
begin
|
||||
if Windows.IsWindowVisible(AWinControl.Handle) then
|
||||
if AWinControl.HandleAllocated then
|
||||
ScrollWindowEx(AWinControl.Handle, DeltaX, DeltaY, nil, nil, 0, nil, SW_INVALIDATE or SW_ERASE or SW_SCROLLCHILDREN);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user