mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 09:28:07 +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;
|
||||
FPenPos: TQtPoint;
|
||||
FOwnPainter: Boolean;
|
||||
FUserDC: boolean;
|
||||
SelFont: TQtFont;
|
||||
SelBrush: TQtBrush;
|
||||
SelPen: TQtPen;
|
||||
@ -476,6 +477,7 @@ type
|
||||
procedure translate(dx: Double; dy: Double);
|
||||
property Metrics: TQtFontMetrics read GetMetrics;
|
||||
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;
|
||||
|
||||
{ TQtPixmap }
|
||||
@ -2209,6 +2211,7 @@ begin
|
||||
|
||||
{NOTE FOR QT DEVELOPERS: Whenever you call TQtDeviceContext.Create() outside
|
||||
of TQtWidgetSet.BeginPaint() SET APaintEvent TO FALSE !}
|
||||
FUserDC := False;
|
||||
Parent := nil;
|
||||
ParentPixmap := nil;
|
||||
FMetrics := nil;
|
||||
@ -2247,6 +2250,7 @@ end;
|
||||
|
||||
constructor TQtDeviceContext.CreatePrinterContext(ADevice: QPrinterH);
|
||||
begin
|
||||
FUserDC := False;
|
||||
SelFont := nil;
|
||||
SelBrush := nil;
|
||||
SelPen := nil;
|
||||
@ -2262,6 +2266,7 @@ end;
|
||||
|
||||
constructor TQtDeviceContext.CreateFromPainter(APainter: QPainterH);
|
||||
begin
|
||||
FUserDC := False;
|
||||
SelFont := nil;
|
||||
SelBrush := nil;
|
||||
SelPen := nil;
|
||||
|
@ -2848,7 +2848,12 @@ begin
|
||||
Widget := TQtWidget(hWnd);
|
||||
Result := Widget.Context;
|
||||
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
|
||||
Result := HDC(QtScreenContext);
|
||||
|
||||
@ -5264,7 +5269,12 @@ begin
|
||||
|
||||
Result := 0;
|
||||
|
||||
if IsValidDC(DC) then Exit;
|
||||
if IsValidDC(DC) then
|
||||
begin
|
||||
if TQtDeviceContext(DC).UserDC then
|
||||
TQtDeviceContext(DC).Free;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Result := 1;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user