mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 09:39:13 +02:00
QT:
- repaint only changed region while drawing caret git-svn-id: trunk@11595 -
This commit is contained in:
parent
426359fa52
commit
8f126b8372
@ -43,6 +43,9 @@ uses
|
||||
LCLType, LCLIntf, Graphics, ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TEmulatedCaret }
|
||||
|
||||
TEmulatedCaret = class(TComponent)
|
||||
private
|
||||
FTimer: TTimer;
|
||||
@ -60,6 +63,7 @@ type
|
||||
procedure DrawCaret; virtual;
|
||||
function CreateColorPixmap(Color: Cardinal): QPixmapH;
|
||||
procedure SetWidget(AWidget: TQtWidget);
|
||||
procedure UpdateCaret;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -322,7 +326,10 @@ function TEmulatedCaret.Hide: Boolean;
|
||||
begin
|
||||
Result := IsValid;
|
||||
if Result and FVisible then
|
||||
begin
|
||||
FVisible := False;
|
||||
UpdateCaret;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
||||
@ -343,8 +350,8 @@ end;
|
||||
procedure TEmulatedCaret.DoTimer(Sender: TObject);
|
||||
begin
|
||||
FVisibleState := not FVisibleState;
|
||||
if FVisible and (FWidget <> nil) and not FWidget.InPaint then
|
||||
FWidget.Update;
|
||||
if FVisible then
|
||||
UpdateCaret;
|
||||
end;
|
||||
|
||||
procedure TEmulatedCaret.Lock;
|
||||
@ -403,4 +410,18 @@ begin
|
||||
FWndId := 0;
|
||||
end;
|
||||
|
||||
procedure TEmulatedCaret.UpdateCaret;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
if (FWidget <> nil) and not FWidget.InPaint then
|
||||
begin
|
||||
R.Left := FPos.x;
|
||||
R.Top := FPos.y;
|
||||
R.Right := R.Left + FWidth;
|
||||
R.Bottom := R.Top + FHeight;
|
||||
FWidget.Update(@R);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -108,8 +108,8 @@ type
|
||||
procedure SetColor(const Value: PQColor); virtual;
|
||||
procedure SetTextColor(const Value: PQColor); virtual;
|
||||
procedure SetCursor(const ACursor: QCursorH); virtual;
|
||||
procedure Update;
|
||||
procedure Repaint;
|
||||
procedure Update(ARect: PRect = nil);
|
||||
procedure Repaint(ARect: PRect = nil);
|
||||
procedure setWindowTitle(Str: PWideString);
|
||||
procedure WindowTitle(Str: PWideString);
|
||||
procedure Hide;
|
||||
@ -1544,9 +1544,12 @@ end;
|
||||
|
||||
Schedules a paint event for processing when Qt returns to the main event loop
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TQtWidget.Update;
|
||||
procedure TQtWidget.Update(ARect: PRect = nil);
|
||||
begin
|
||||
QWidget_update(Widget);
|
||||
if ARect <> nil then
|
||||
QWidget_update(Widget, ARect)
|
||||
else
|
||||
QWidget_update(Widget);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1558,7 +1561,10 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TQtWidget.Repaint;
|
||||
begin
|
||||
QWidget_repaint(Widget);
|
||||
if ARect <> nil then
|
||||
QWidget_repaint(Widget, ARect)
|
||||
else
|
||||
QWidget_repaint(Widget);
|
||||
end;
|
||||
|
||||
procedure TQtWidget.setWindowTitle(Str: PWideString);
|
||||
|
@ -2763,7 +2763,7 @@ begin
|
||||
WriteLn('[WinAPI Invalidate Rect]');
|
||||
{$endif}
|
||||
|
||||
QWidget_update(TQtWidget(aHandle).Widget,Rect);
|
||||
TQtWidget(aHandle).Update(Rect);
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
@ -3950,7 +3950,7 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI UpdateWindow]');
|
||||
{$endif}
|
||||
QWidget_update(TQtWidget(Handle).Widget);
|
||||
TQtWidget(Handle).Update;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user