Qt: TQtWidgetSet.GetDC() grab widget to ParentPixmap in QtDefaultContext if GetDC() is asked outside of paint event for widget.

git-svn-id: trunk@30542 -
This commit is contained in:
zeljko 2011-05-03 14:55:42 +00:00
parent 0abaa5be8e
commit d9c1364472

View File

@ -2263,6 +2263,7 @@ end;
function TQtWidgetSet.GetDC(hWnd: HWND): HDC;
var
Widget: TQtWidget;
B: Boolean;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('Trace:> [WinAPI GetDC] hWnd: ', dbghex(hWnd));
@ -2273,7 +2274,16 @@ begin
Widget := TQtWidget(hWnd);
Result := Widget.Context;
if Result = 0 then
begin
B := QPainter_isActive(QtDefaultContext.Widget);
if B then
QPainter_end(QtDefaultContext.Widget);
QPixmap_grabWidget(QtDefaultContext.ParentPixmap, Widget.Widget,
0, 0, Widget.getWidth, Widget.getHeight);
if B then
QPainter_begin(QtDefaultContext.Widget, QtDefaultContext.ParentPixmap);
Result := HDC(QtDefaultContext);
end;
end else
Result := HDC(QtScreenContext);