mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 21:19:24 +02:00
Qt: fixed TQtWidgetSet.drawText() according to msdn docs.fixed #17329
git-svn-id: trunk@27249 -
This commit is contained in:
parent
319db72532
commit
42a3b3918b
@ -1269,7 +1269,12 @@ begin
|
|||||||
|
|
||||||
if (Flags and DT_CALCRECT) = DT_CALCRECT then
|
if (Flags and DT_CALCRECT) = DT_CALCRECT then
|
||||||
begin
|
begin
|
||||||
ARect.Right := ARect.Left + R.Right - R.Left;
|
if (Flags and DT_WORDBREAK = DT_WORDBREAK) and
|
||||||
|
((R.Bottom - R.Top) > (ARect.Bottom - ARect.Top)) then
|
||||||
|
// MSDN says do not touch rect width when we have DT_WORDBREAK flag
|
||||||
|
// and new text is multiline (if R height > ARect height).See #17329.
|
||||||
|
else
|
||||||
|
ARect.Right := ARect.Left + R.Right - R.Left;
|
||||||
ARect.Bottom := ARect.Top + R.Bottom - R.Top;
|
ARect.Bottom := ARect.Top + R.Bottom - R.Top;
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
WriteLn('[WinAPI DrawText] Rect=', dbgs(ARect));
|
WriteLn('[WinAPI DrawText] Rect=', dbgs(ARect));
|
||||||
@ -1289,6 +1294,18 @@ begin
|
|||||||
CalculateOffsetWithAngle(QtDC.font.Angle, Pt.X, Pt.Y);
|
CalculateOffsetWithAngle(QtDC.font.Angle, Pt.X, Pt.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// we cannot fit into rectangle, so use DT_SINGLELINE.See #17329.
|
||||||
|
// http://msdn.microsoft.com/en-us/library/dd162498%28v=VS.85%29.aspx
|
||||||
|
if QtDC.getClipping and
|
||||||
|
(Flags and DT_NOCLIP = DT_NOCLIP) and
|
||||||
|
(Flags and DT_WORDBREAK = DT_WORDBREAK) and
|
||||||
|
(Flags and DT_SINGLELINE = DT_SINGLELINE) and
|
||||||
|
((R.Bottom - R.Top) >= (ARect.Bottom - ARect.Top)) then
|
||||||
|
begin
|
||||||
|
Flags := Flags and not DT_WORDBREAK;
|
||||||
|
F := DTFlagsToQtFlags(Flags);
|
||||||
|
end;
|
||||||
|
|
||||||
with ARect do
|
with ARect do
|
||||||
QtDC.DrawText(Left + Pt.X, Top + Pt.Y, Right-Left, Bottom-Top, F, @WideStr);
|
QtDC.DrawText(Left + Pt.X, Top + Pt.Y, Right-Left, Bottom-Top, F, @WideStr);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user