mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 14:09:16 +02:00
Qt: optimized tooltip position calculation.
git-svn-id: trunk@24032 -
This commit is contained in:
parent
9444dd3460
commit
6e8c411156
@ -10027,11 +10027,15 @@ var
|
|||||||
D: TRect;
|
D: TRect;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
P: TPoint;
|
P: TPoint;
|
||||||
|
Pt: TQtPoint;
|
||||||
ScreenNumber: integer;
|
ScreenNumber: integer;
|
||||||
|
W,H: integer;
|
||||||
begin
|
begin
|
||||||
if AVisible then
|
if AVisible then
|
||||||
begin
|
begin
|
||||||
R := getGeometry;
|
R := getGeometry;
|
||||||
|
W := R.Right - R.Left;
|
||||||
|
H := R.Bottom - R.Top;
|
||||||
LCLIntf.GetCursorPos(P);
|
LCLIntf.GetCursorPos(P);
|
||||||
|
|
||||||
{we must make proper positioning of our hint if
|
{we must make proper positioning of our hint if
|
||||||
@ -10050,25 +10054,30 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
if (P.X + getWidth > D.Right - D.Left) then
|
if (P.X + W > D.Right - D.Left) then
|
||||||
P.X := P.X - (ToolTipOffset + getWidth);
|
P.X := P.X - ((ToolTipOffset) + W);
|
||||||
|
|
||||||
if (P.Y + getHeight > D.Bottom - D.Top) then
|
if (P.Y + H > D.Bottom - D.Top) then
|
||||||
P.Y := P.Y - ((ToolTipOffset * 6) + getHeight);
|
P.Y := P.Y - ((ToolTipOffset * 6) + H);
|
||||||
|
|
||||||
if P.Y < D.Top then
|
if P.Y < D.Top then
|
||||||
P.Y := D.Top;
|
P.Y := D.Top;
|
||||||
|
|
||||||
if (P.X + getWidth > D.Right - D.Left) then
|
if (P.X + W > D.Right - D.Left) then
|
||||||
P.X := D.Right - D.Left - getWidth;
|
P.X := D.Right - D.Left - W;
|
||||||
|
|
||||||
if P.X < D.Left then
|
if P.X < D.Left then
|
||||||
P.X := D.Left;
|
P.X := D.Left;
|
||||||
|
|
||||||
if P.Y + getHeight > D.Bottom - D.Top then
|
if P.Y + H > D.Bottom - D.Top then
|
||||||
P.Y := D.Bottom - D.Top - getHeight;
|
P.Y := D.Bottom - D.Top - H;
|
||||||
|
|
||||||
move(P.X, P.Y);
|
Pt := getPos;
|
||||||
|
|
||||||
|
if (P.X >= Pt.X) and (P.X <= Pt.X + W) then
|
||||||
|
move(P.X + ToolTipOffset, P.Y)
|
||||||
|
else
|
||||||
|
move(P.X , P.Y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
inherited setVisible(AVisible);
|
inherited setVisible(AVisible);
|
||||||
|
Loading…
Reference in New Issue
Block a user