mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-25 21:42:39 +02:00
Qt:
- more checks while setting / getting scroll info - another trial to speedup TCustomControl git-svn-id: trunk@12171 -
This commit is contained in:
parent
3769cc722c
commit
a5a7bd7796
@ -125,7 +125,7 @@ type
|
||||
procedure SlotMouseMove(Event: QEventH); cdecl;
|
||||
procedure SlotMouseWheel(Sender: QObjectH; Event: QEventH); cdecl;
|
||||
procedure SlotMove(Event: QEventH); cdecl;
|
||||
procedure SlotPaint(Event: QEventH); cdecl;
|
||||
procedure SlotPaint(Sender: QObjectH; Event: QEventH); cdecl;
|
||||
procedure SlotResize; cdecl;
|
||||
procedure SlotContextMenu; cdecl;
|
||||
procedure SlotLCLMessage(Sender: QObjectH; Event: QEventH); cdecl;
|
||||
@ -133,8 +133,8 @@ type
|
||||
procedure Activate;
|
||||
procedure BringToFront;
|
||||
procedure OffsetMousePos(APoint: PQtPoint); virtual;
|
||||
procedure Update(ARect: PRect = nil);
|
||||
procedure Repaint(ARect: PRect = nil);
|
||||
procedure Update(ARect: PRect = nil); virtual;
|
||||
procedure Repaint(ARect: PRect = nil); virtual;
|
||||
procedure setWindowTitle(Str: PWideString);
|
||||
procedure WindowTitle(Str: PWideString);
|
||||
procedure Hide;
|
||||
@ -286,6 +286,8 @@ type
|
||||
procedure setVerticalScrollBar(AScrollBar: TQtScrollBar);
|
||||
procedure setVisible(visible: Boolean); override;
|
||||
procedure viewportNeeded;
|
||||
procedure Update(ARect: PRect = nil); override;
|
||||
procedure Repaint(ARect: PRect = nil); override;
|
||||
end;
|
||||
|
||||
{ TQtArrow }
|
||||
@ -1359,7 +1361,7 @@ begin
|
||||
end;
|
||||
QEventMove: SlotMove(Event);
|
||||
QEventResize: SlotResize;
|
||||
QEventPaint: SlotPaint(Event);
|
||||
QEventPaint: SlotPaint(Sender, Event);
|
||||
QEventContextMenu: SlotContextMenu;
|
||||
QEventLCLMessage:
|
||||
begin
|
||||
@ -1943,7 +1945,7 @@ end;
|
||||
|
||||
Sends a LM_PAINT message to the LCL. This is for windowed controls only
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TQtWidget.SlotPaint(Event: QEventH); cdecl;
|
||||
procedure TQtWidget.SlotPaint(Sender: QObjectH; Event: QEventH); cdecl;
|
||||
var
|
||||
Msg: TLMPaint;
|
||||
AStruct: PPaintStruct;
|
||||
@ -5885,6 +5887,7 @@ constructor TQtMenu.Create(const AMenuItem: TMenuItem);
|
||||
var
|
||||
AParams: TCreateParams;
|
||||
begin
|
||||
FillChar(AParams, SizeOf(AParams), #0);
|
||||
FMenuItem := AMenuItem;
|
||||
inherited Create(nil, AParams);
|
||||
end;
|
||||
@ -6236,7 +6239,7 @@ begin
|
||||
{$ifdef VerboseQt}
|
||||
WriteLn('TQtAbstractScrollArea.Create');
|
||||
{$endif}
|
||||
FViewPortWidget := niL;
|
||||
FViewPortWidget := nil;
|
||||
Result := QScrollArea_create();
|
||||
QWidget_setAttribute(Result, QtWA_NoMousePropagation);
|
||||
end;
|
||||
@ -6448,6 +6451,28 @@ begin
|
||||
QAbstractScrollArea_setViewport(QAbstractScrollAreaH(Widget), FViewPortWidget.Widget);
|
||||
end;
|
||||
|
||||
procedure TQtAbstractScrollArea.Update(ARect: PRect);
|
||||
begin
|
||||
if ARect <> nil then
|
||||
begin
|
||||
OffsetRect(ARect^, -1, -1);
|
||||
QWidget_update(viewport.widget, ARect);
|
||||
end
|
||||
else
|
||||
QWidget_update(viewport.widget);
|
||||
end;
|
||||
|
||||
procedure TQtAbstractScrollArea.Repaint(ARect: PRect);
|
||||
begin
|
||||
if ARect <> nil then
|
||||
begin
|
||||
OffsetRect(ARect^, -1, -1);
|
||||
QWidget_repaint(viewport.widget, ARect);
|
||||
end
|
||||
else
|
||||
QWidget_repaint(viewport.widget);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtAbstractScrollArea.setScrollStyle
|
||||
Params: None
|
||||
|
@ -2396,27 +2396,29 @@ begin
|
||||
|
||||
if not TQtWidget(Handle).LCLObject.InheritsFrom(TCustomScrollBar) then
|
||||
begin
|
||||
|
||||
case BarFlag of
|
||||
SB_HORZ: QtScrollBar := TQtAbstractScrollArea(Handle).horizontalScrollBar;
|
||||
SB_VERT: QtScrollBar := TQtAbstractScrollArea(Handle).verticalScrollBar;
|
||||
end;
|
||||
if (TQtWidget(Handle) is TQtAbstractScrollArea) then
|
||||
begin
|
||||
case BarFlag of
|
||||
SB_HORZ: QtScrollBar := TQtAbstractScrollArea(Handle).horizontalScrollBar;
|
||||
SB_VERT: QtScrollBar := TQtAbstractScrollArea(Handle).verticalScrollBar;
|
||||
end;
|
||||
|
||||
if QtScrollBar = nil then exit;
|
||||
if QtScrollBar = nil then exit;
|
||||
|
||||
ScrollInfo.nTrackPos := 0;
|
||||
ScrollInfo.nTrackPos := 0;
|
||||
|
||||
ScrollInfo.nMax := QtScrollBar.getMax;
|
||||
ScrollInfo.nMin := QtScrollBar.getMin;
|
||||
ScrollInfo.nPage := QtScrollBar.getPageStep;
|
||||
ScrollInfo.nPos := QtScrollBar.getValue;
|
||||
ScrollInfo.fMask := SIF_ALL;
|
||||
ScrollInfo.cbSize := SizeOf(ScrollInfo);
|
||||
|
||||
Result := True;
|
||||
ScrollInfo.nMax := QtScrollBar.getMax;
|
||||
ScrollInfo.nMin := QtScrollBar.getMin;
|
||||
ScrollInfo.nPage := QtScrollBar.getPageStep;
|
||||
ScrollInfo.nPos := QtScrollBar.getValue;
|
||||
ScrollInfo.fMask := SIF_ALL;
|
||||
ScrollInfo.cbSize := SizeOf(ScrollInfo);
|
||||
Result := True;
|
||||
end else
|
||||
Result := False;
|
||||
end
|
||||
else
|
||||
FScrollBar := TScrollBar(TQtWidget(Handle).LCLObject);
|
||||
FScrollBar := TScrollBar(TQtWidget(Handle).LCLObject);
|
||||
|
||||
if Assigned(FScrollBar) then
|
||||
begin
|
||||
@ -3224,8 +3226,7 @@ begin
|
||||
begin
|
||||
R := TQtWidget(aHandle).getClientBounds;
|
||||
OffsetRect(Rect^, R.Left, R.Top);
|
||||
if bErase and (TQtWidget(aHandle).Context <> 0) then
|
||||
TQtDeviceContext(TQtWidget(aHandle).Context).eraseRect(Rect);
|
||||
// no need to handle bErase. Qt automatically erase rect on paint event according to docs
|
||||
TQtWidget(aHandle).Update(Rect);
|
||||
end else
|
||||
TQtWidget(aHandle).Update;
|
||||
@ -4188,7 +4189,7 @@ begin
|
||||
Scrollbar.Width := R.Right - ScrollBar.Height;
|
||||
ScrollBar.Top := R.Bottom - ScrollBar.Height;
|
||||
|
||||
if not TQtWidget(Handle).LCLObject.InheritsFrom(TCustomForm) then
|
||||
if (TQtWidget(Handle) is TQtAbstractScrollArea) then
|
||||
begin
|
||||
ScrollBar.Parent := TQtAbstractScrollArea(Handle).LCLObject;
|
||||
TQtAbstractScrollArea(Handle).sethorizontalScrollBar(TQtScrollBar(ScrollBar.Handle));
|
||||
@ -4229,7 +4230,7 @@ begin
|
||||
ScrollBar.Top := 0;
|
||||
{TODO: Check why BorderWidth is 0 when BorderStyle is eg. bsSingle ?!? }
|
||||
ScrollBar.Left := R.Right - ScrollBar.Width;
|
||||
if not TQtWidget(Handle).LCLObject.InheritsFrom(TCustomForm) then
|
||||
if (TQtWidget(Handle) is TQtAbstractScrollArea) then
|
||||
begin
|
||||
ScrollBar.Parent := TQtAbstractScrollArea(Handle).LCLObject;
|
||||
TQtAbstractScrollArea(Handle).setVerticalScrollBar(TQtScrollBar(ScrollBar.Handle));
|
||||
|
Loading…
Reference in New Issue
Block a user