mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 18:59:06 +02:00
Qt: fixed wrong implementation of TQtWidgetSet.RectVisible(), now it works few times faster, added TQtScrollBar.setFocusPolicy, TQtRegion.intersects().
git-svn-id: trunk@25091 -
This commit is contained in:
parent
4ec26a9c40
commit
9cfcda57d1
@ -287,6 +287,8 @@ type
|
||||
destructor Destroy; override;
|
||||
function containsPoint(X,Y: Integer): Boolean;
|
||||
function containsRect(R: TRect): Boolean;
|
||||
function intersects(R: TRect): Boolean; overload;
|
||||
function intersects(Rgn: QRegionH): Boolean; overload;
|
||||
function GetRegionType: integer;
|
||||
function getBoundingRect: TRect;
|
||||
function numRects: Integer;
|
||||
@ -1767,6 +1769,16 @@ begin
|
||||
Result := QRegion_contains(Widget, PRect(@R));
|
||||
end;
|
||||
|
||||
function TQtRegion.intersects(R: TRect): Boolean;
|
||||
begin
|
||||
Result := QRegion_intersects(Widget, PRect(@R));
|
||||
end;
|
||||
|
||||
function TQtRegion.intersects(Rgn: QRegionH): Boolean;
|
||||
begin
|
||||
Result := QRegion_intersects(Widget, Rgn);
|
||||
end;
|
||||
|
||||
function TQtRegion.GetRegionType: integer;
|
||||
var
|
||||
R: TRect;
|
||||
|
@ -328,6 +328,7 @@ type
|
||||
protected
|
||||
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
|
||||
public
|
||||
procedure setFocusPolicy(const APolicy: QtFocusPolicy); override;
|
||||
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
|
||||
procedure AttachEvents; override;
|
||||
end;
|
||||
@ -5618,6 +5619,14 @@ begin
|
||||
FHasPaint := True;
|
||||
end;
|
||||
|
||||
procedure TQtScrollBar.setFocusPolicy(const APolicy: QtFocusPolicy);
|
||||
begin
|
||||
if FOwnWidget and Assigned(LCLObject) and not LCLObject.TabStop then
|
||||
inherited setFocusPolicy(QtNoFocus)
|
||||
else
|
||||
inherited setFocusPolicy(APolicy);
|
||||
end;
|
||||
|
||||
function TQtScrollBar.EventFilter(Sender: QObjectH; Event: QEventH): Boolean;
|
||||
cdecl;
|
||||
begin
|
||||
|
@ -4037,28 +4037,17 @@ end;
|
||||
|
||||
function TQtWidgetSet.RectVisible(dc : hdc; const ARect: TRect) : Boolean;
|
||||
var
|
||||
w: QWidgetH;
|
||||
Region: QRegionH;
|
||||
QtDC: TQtDeviceContext;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
writeln('[WinAPI RectVisible] ');
|
||||
{$endif}
|
||||
Result := False;
|
||||
if not IsValidDC(DC) then Exit;
|
||||
w := TQtDeviceContext(DC).Parent;
|
||||
if w <> nil then
|
||||
begin
|
||||
if QWidget_isVisible(w) then
|
||||
begin
|
||||
Region := QRegion_create;
|
||||
try
|
||||
QWidget_visibleRegion(w, Region);
|
||||
Result := QRegion_contains(Region, PRect(@ARect));
|
||||
finally
|
||||
QRegion_destroy(Region);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
// as MSDN says only clipping region can play here
|
||||
if QtDC.getClipping then
|
||||
Result := QtDC.getClipRegion.containsRect(ARect);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user