mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-26 00:50:28 +01:00
qt: implement custom pen dashes for qt4.4
git-svn-id: trunk@17260 -
This commit is contained in:
parent
438886ae49
commit
227502e9d1
@ -221,6 +221,7 @@ type
|
||||
function getJoinStyle: QtPenJoinStyle;
|
||||
function getWidth: Integer;
|
||||
function getStyle: QtPenStyle;
|
||||
function getDashPattern: TQRealArray;
|
||||
|
||||
procedure setCapStyle(pcs: QtPenCapStyle);
|
||||
procedure setColor(p1: TQColor);
|
||||
@ -229,6 +230,7 @@ type
|
||||
procedure setStyle(AStyle: QtPenStyle);
|
||||
procedure setBrush(brush: QBrushH);
|
||||
procedure setWidth(p1: Integer);
|
||||
procedure setDashPattern(APattern: PDWord; ALength: DWord);
|
||||
|
||||
property IsExtPen: Boolean read FIsExtPen write FIsExtPen;
|
||||
end;
|
||||
@ -1458,6 +1460,15 @@ begin
|
||||
Result := QPen_style(Widget);
|
||||
end;
|
||||
|
||||
function TQtPen.getDashPattern: TQRealArray;
|
||||
begin
|
||||
{$ifdef USE_QT_44}
|
||||
QPen_dashPattern(Widget, @Result);
|
||||
{$else}
|
||||
Result := nil;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtPen.setBrush
|
||||
Params: None
|
||||
@ -1489,6 +1500,21 @@ begin
|
||||
QPen_setWidth(Widget, p1);
|
||||
end;
|
||||
|
||||
procedure TQtPen.setDashPattern(APattern: PDWord; ALength: DWord);
|
||||
{$ifdef USE_QT_44}
|
||||
var
|
||||
QtPattern: TQRealArray;
|
||||
i: integer;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef USE_QT_44}
|
||||
SetLength(QtPattern, ALength);
|
||||
for i := 0 to ALength - 1 do
|
||||
QtPattern[i] := APattern[i];
|
||||
QPen_setDashPattern(Widget, @QtPattern);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TQtPen.setJoinStyle(pcs: QtPenJoinStyle);
|
||||
begin
|
||||
QPen_setJoinStyle(Widget, pcs);
|
||||
|
||||
@ -1508,9 +1508,7 @@ begin
|
||||
end;
|
||||
|
||||
if (dwPenStyle and PS_STYLE_MASK) = PS_USERSTYLE then
|
||||
begin
|
||||
// TODO: use QPen_setDashPatten which are available since qt 4.1
|
||||
end;
|
||||
QtPen.setDashPattern(lpStyle, dwStyleCount);
|
||||
|
||||
QPen_Color(QtPen.Widget, @Color);
|
||||
ColorRefToTQColor(ColorToRGB(lplb.lbColor), Color);
|
||||
@ -2242,6 +2240,8 @@ var
|
||||
ALogFont: PLogFont absolute Buf;
|
||||
ALogPen: PLogPen absolute Buf;
|
||||
AExtLogPen: PExtLogPen absolute Buf;
|
||||
Dashes: TQRealArray;
|
||||
i: integer;
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
ObjType: string;
|
||||
{$endif}
|
||||
@ -2330,12 +2330,20 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Buf = nil then
|
||||
Result := SizeOf(TExtLogPen)
|
||||
else
|
||||
if BufSize >= SizeOf(TExtLogPen) then
|
||||
i := SizeOf(TExtLogPen);
|
||||
if APen.getStyle = QtCustomDashLine then
|
||||
begin
|
||||
Result := SizeOf(TExtLogPen);
|
||||
Dashes := APen.getDashPattern;
|
||||
inc(i, (Length(Dashes) - 1) * SizeOf(DWord));
|
||||
end
|
||||
else
|
||||
Dashes := nil;
|
||||
if Buf = nil then
|
||||
Result := i
|
||||
else
|
||||
if BufSize >= i then
|
||||
begin
|
||||
Result := i;
|
||||
AExtLogPen^.elpPenStyle := QtPenStyleToWinStyleMap[APen.getStyle];
|
||||
|
||||
if not APen.getCosmetic then
|
||||
@ -2362,10 +2370,15 @@ begin
|
||||
AExtLogPen^.elpBrushStyle := BS_SOLID;
|
||||
TQColorToColorRef(APen.getColor, AExtLogPen^.elpColor);
|
||||
AExtLogPen^.elpHatch := 0;
|
||||
{ TODO: PS_USERSTYLE
|
||||
elpNumEntries: DWORD;
|
||||
elpStyleEntry: array[0..0] of DWORD;
|
||||
}
|
||||
|
||||
AExtLogPen^.elpNumEntries := Length(Dashes);
|
||||
if AExtLogPen^.elpNumEntries > 0 then
|
||||
begin
|
||||
for i := 0 to AExtLogPen^.elpNumEntries - 1 do
|
||||
PDword(@AExtLogPen^.elpStyleEntry)[i] := Trunc(Dashes[i]);
|
||||
end
|
||||
else
|
||||
AExtLogPen^.elpStyleEntry[0] := 0;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user