Qt5: provide current widget screen when grabbing window

git-svn-id: trunk@62844 -
This commit is contained in:
zeljko 2020-04-01 12:16:28 +00:00
parent 7c479cba63
commit 8ffd2f7f25
2 changed files with 15 additions and 2 deletions

View File

@ -6824,6 +6824,7 @@ var
OldBkColor: TColorRef;
RestoreClip: Boolean;
AClipRect: TRect;
AWidgetID: LongWord;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI StretchMaskBlt]',
@ -6845,7 +6846,8 @@ begin
begin
with SrcQDC.getDeviceSize do
TmpPixmap := QPixmap_create(x, y);
QPixmap_grabWindow(TmpPixmap, QWidget_winId(SrcQDC.Parent), 0, 0);
AWidgetID := QWidget_winId(SrcQDC.Parent);
QPixmap_grabWindow(TmpPixmap, AWidgetID, 0, 0);
Image := QImage_create();
QPixmap_toImage(TmpPixmap, Image);
QPixmap_destroy(TmpPixmap);

View File

@ -6767,6 +6767,9 @@ var
OldBkColor: TColorRef;
RestoreClip: Boolean;
AClipRect: TRect;
AWindow: QWindowH;
AScreen: QScreenH;
AWidgetID: PtrUInt;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI StretchMaskBlt]',
@ -6788,7 +6791,15 @@ begin
begin
with SrcQDC.getDeviceSize do
TmpPixmap := QPixmap_create(x, y);
QScreen_grabWindow(QGuiApplication_primaryScreen, TmpPixmap, QWidget_winId(SrcQDC.Parent), 0, 0);
AWidgetID := QWidget_winId(SrcQDC.Parent);
AWindow := QWidget_windowHandle(SrcQDC.Parent);
if AWindow <> nil then
AScreen := QWindow_screen(AWindow)
else
AScreen := QGuiApplication_primaryScreen();
QScreen_grabWindow(AScreen, TmpPixmap, AWidgetID, 0, 0);
Image := QImage_create();
QPixmap_toImage(TmpPixmap, Image);
QPixmap_destroy(TmpPixmap);