mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 23:19:30 +02:00
Merged revision(s) 49081 #381c46845f from trunk:
Qt: create properly sized device context in GetDC(). issue #28106 ........ git-svn-id: branches/fixes_1_4@49182 -
This commit is contained in:
parent
9004eab5c7
commit
1b4b1ad15a
@ -368,6 +368,7 @@ type
|
|||||||
FRopMode: Integer;
|
FRopMode: Integer;
|
||||||
FPenPos: TQtPoint;
|
FPenPos: TQtPoint;
|
||||||
FOwnPainter: Boolean;
|
FOwnPainter: Boolean;
|
||||||
|
FUserDC: boolean;
|
||||||
SelFont: TQtFont;
|
SelFont: TQtFont;
|
||||||
SelBrush: TQtBrush;
|
SelBrush: TQtBrush;
|
||||||
SelPen: TQtPen;
|
SelPen: TQtPen;
|
||||||
@ -476,6 +477,7 @@ type
|
|||||||
procedure translate(dx: Double; dy: Double);
|
procedure translate(dx: Double; dy: Double);
|
||||||
property Metrics: TQtFontMetrics read GetMetrics;
|
property Metrics: TQtFontMetrics read GetMetrics;
|
||||||
property Rop2: Integer read GetRop write SetRop;
|
property Rop2: Integer read GetRop write SetRop;
|
||||||
|
property UserDC: boolean read FUserDC write FUserDC; {if context is created from GetDC() and it's not default DC.}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQtPixmap }
|
{ TQtPixmap }
|
||||||
@ -2209,6 +2211,7 @@ begin
|
|||||||
|
|
||||||
{NOTE FOR QT DEVELOPERS: Whenever you call TQtDeviceContext.Create() outside
|
{NOTE FOR QT DEVELOPERS: Whenever you call TQtDeviceContext.Create() outside
|
||||||
of TQtWidgetSet.BeginPaint() SET APaintEvent TO FALSE !}
|
of TQtWidgetSet.BeginPaint() SET APaintEvent TO FALSE !}
|
||||||
|
FUserDC := False;
|
||||||
Parent := nil;
|
Parent := nil;
|
||||||
ParentPixmap := nil;
|
ParentPixmap := nil;
|
||||||
FMetrics := nil;
|
FMetrics := nil;
|
||||||
@ -2247,6 +2250,7 @@ end;
|
|||||||
|
|
||||||
constructor TQtDeviceContext.CreatePrinterContext(ADevice: QPrinterH);
|
constructor TQtDeviceContext.CreatePrinterContext(ADevice: QPrinterH);
|
||||||
begin
|
begin
|
||||||
|
FUserDC := False;
|
||||||
SelFont := nil;
|
SelFont := nil;
|
||||||
SelBrush := nil;
|
SelBrush := nil;
|
||||||
SelPen := nil;
|
SelPen := nil;
|
||||||
@ -2262,6 +2266,7 @@ end;
|
|||||||
|
|
||||||
constructor TQtDeviceContext.CreateFromPainter(APainter: QPainterH);
|
constructor TQtDeviceContext.CreateFromPainter(APainter: QPainterH);
|
||||||
begin
|
begin
|
||||||
|
FUserDC := False;
|
||||||
SelFont := nil;
|
SelFont := nil;
|
||||||
SelBrush := nil;
|
SelBrush := nil;
|
||||||
SelPen := nil;
|
SelPen := nil;
|
||||||
|
@ -2848,7 +2848,12 @@ begin
|
|||||||
Widget := TQtWidget(hWnd);
|
Widget := TQtWidget(hWnd);
|
||||||
Result := Widget.Context;
|
Result := Widget.Context;
|
||||||
if Result = 0 then
|
if Result = 0 then
|
||||||
Result := HDC(QtDefaultContext);
|
begin
|
||||||
|
{issue #28106}
|
||||||
|
Result := HDC(TQtDeviceContext.Create(Widget.Widget, False));
|
||||||
|
{can be destroyed via ReleaseDC()}
|
||||||
|
TQtDeviceContext(Result).UserDC := True;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
Result := HDC(QtScreenContext);
|
Result := HDC(QtScreenContext);
|
||||||
|
|
||||||
@ -5264,7 +5269,12 @@ begin
|
|||||||
|
|
||||||
Result := 0;
|
Result := 0;
|
||||||
|
|
||||||
if IsValidDC(DC) then Exit;
|
if IsValidDC(DC) then
|
||||||
|
begin
|
||||||
|
if TQtDeviceContext(DC).UserDC then
|
||||||
|
TQtDeviceContext(DC).Free;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
Result := 1;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user