mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 00:49:26 +01:00
Qt,Gtk2: corrected return of Size.cx, simplified and fixed code in qt implementation about Size.cx returned values.
git-svn-id: trunk@27416 -
This commit is contained in:
parent
3ecc366dbd
commit
13bd9d7378
@ -5557,7 +5557,10 @@ begin
|
|||||||
inc(MaxCount^);
|
inc(MaxCount^);
|
||||||
PartialWidths[i] := Size.cx;
|
PartialWidths[i] := Size.cx;
|
||||||
end else
|
end else
|
||||||
|
begin
|
||||||
|
dec(Size.cx, Rect.Width);
|
||||||
break;
|
break;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
PartialWidths[i] := Size.cx;
|
PartialWidths[i] := Size.cx;
|
||||||
if Size.cy < Rect.Height then
|
if Size.cy < Rect.Height then
|
||||||
|
|||||||
@ -3484,7 +3484,6 @@ function TQtWidgetSet.GetTextExtentExPoint(DC: HDC; Str: PChar; Count,
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
w: Integer;
|
w: Integer;
|
||||||
Accumulator: Integer;
|
|
||||||
AStr: WideString;
|
AStr: WideString;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -3492,27 +3491,33 @@ begin
|
|||||||
with TQtDeviceContext(DC) do
|
with TQtDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
AStr := GetUtf8String(Str);
|
AStr := GetUtf8String(Str);
|
||||||
|
if PartialWidths = nil then
|
||||||
|
begin
|
||||||
Size.cX := Font.Metrics.Width(@AStr, Count);
|
Size.cX := Font.Metrics.Width(@AStr, Count);
|
||||||
Size.cY := Font.Metrics.Height;
|
Size.cY := Font.Metrics.Height;
|
||||||
if PartialWidths <> nil then
|
end else
|
||||||
begin
|
begin
|
||||||
|
Size.cx := 0;
|
||||||
|
Size.cY := Font.Metrics.Height;
|
||||||
if MaxCount <> nil then
|
if MaxCount <> nil then
|
||||||
MaxCount^ := 0;
|
MaxCount^ := 0;
|
||||||
Accumulator := 0;
|
|
||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
begin
|
begin
|
||||||
w := QFontMetrics_charWidth(Font.Metrics.Widget, @AStr, i);
|
w := QFontMetrics_charWidth(Font.Metrics.Widget, @AStr, i);
|
||||||
Inc(Accumulator, w);
|
Inc(Size.cx, w);
|
||||||
if MaxCount <> nil then
|
if MaxCount <> nil then
|
||||||
begin
|
begin
|
||||||
if Accumulator <= MaxWidth then
|
if Size.cx <= MaxWidth then
|
||||||
begin
|
begin
|
||||||
inc(MaxCount^);
|
inc(MaxCount^);
|
||||||
PartialWidths[i] := Accumulator;
|
PartialWidths[i] := Size.cx;
|
||||||
end else
|
end else
|
||||||
|
begin
|
||||||
|
Dec(Size.cx, w);
|
||||||
break;
|
break;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
PartialWidths[i] := Accumulator;
|
PartialWidths[i] := Size.cx;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user