mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 05:01:50 +02:00
Qt5: do not use deprecated functions from Qt library
git-svn-id: trunk@62872 -
This commit is contained in:
parent
5af9c69f98
commit
ba975b8a39
@ -390,12 +390,14 @@ var
|
|||||||
Context: TQtDeviceContext absolute ADC;
|
Context: TQtDeviceContext absolute ADC;
|
||||||
Widget: TQtWidget;
|
Widget: TQtWidget;
|
||||||
Window: TQtMainWindow;
|
Window: TQtMainWindow;
|
||||||
Pixmap: TQtPixmap;
|
|
||||||
DCSize: TSize;
|
DCSize: TSize;
|
||||||
APoint: TQtPoint;
|
APoint: TQtPoint;
|
||||||
ARect, GRect: TRect;
|
ARect, GRect: TRect;
|
||||||
OffsetY: Integer;
|
OffsetY: Integer;
|
||||||
NewHandle: QPixmapH;
|
Pixmap, NewHandle: QPixmapH;
|
||||||
|
AWidgetID: PtrUInt;
|
||||||
|
AWindow: QWindowH;
|
||||||
|
AScreen: QScreenH;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AWincontrol, 'PaintTo') or (ADC = 0) then
|
if not WSCheckHandleAllocated(AWincontrol, 'PaintTo') or (ADC = 0) then
|
||||||
Exit;
|
Exit;
|
||||||
@ -418,25 +420,33 @@ begin
|
|||||||
cx := Right - Left;
|
cx := Right - Left;
|
||||||
cy := Bottom - Top;
|
cy := Bottom - Top;
|
||||||
end;
|
end;
|
||||||
Pixmap := TQtPixmap.Create(@DCSize);
|
Pixmap := QPixmap_create(PSize(@DCSize));
|
||||||
try
|
try
|
||||||
OffsetRect(GRect, -ARect.Left, -ARect.Top);
|
OffsetRect(GRect, -ARect.Left, -ARect.Top);
|
||||||
Pixmap.grabWidget(Widget.Widget, 0, 0);
|
|
||||||
|
AWidgetID := QWidget_winId(Widget.Widget);
|
||||||
|
AWindow := QWidget_windowHandle(Widget.Widget);
|
||||||
|
if AWindow <> nil then
|
||||||
|
AScreen := QWindow_screen(AWindow)
|
||||||
|
else
|
||||||
|
AScreen := QGuiApplication_primaryScreen();
|
||||||
|
|
||||||
|
QScreen_grabWindow(AScreen, Pixmap, AWidgetID, 0, 0);
|
||||||
|
|
||||||
// apply offset if we have main menu
|
// apply offset if we have main menu
|
||||||
APoint := QtPoint(X, Y + OffsetY);
|
APoint := QtPoint(X, Y + OffsetY);
|
||||||
ARect := Rect(0, 0, Pixmap.getWidth, Pixmap.getHeight);
|
ARect := Rect(0, 0, QPixmap_width(Pixmap), QPixmap_height(Pixmap));
|
||||||
// also scale pixmap by height of menu, so it's catched in our image.
|
// also scale pixmap by height of menu, so it's catched in our image.
|
||||||
if OffsetY <> 0 then
|
if OffsetY <> 0 then
|
||||||
begin
|
begin
|
||||||
NewHandle := QPixmap_create();
|
NewHandle := QPixmap_create();
|
||||||
QPixmap_scaled(Pixmap.Handle, NewHandle, Pixmap.GetWidth, Pixmap.GetHeight - OffsetY);
|
QPixmap_scaled(Pixmap, NewHandle, QPixmap_width(Pixmap), QPixmap_height(Pixmap) - OffsetY);
|
||||||
Context.drawPixmap(@APoint, NewHandle, @ARect);
|
Context.drawPixmap(@APoint, NewHandle, @ARect);
|
||||||
QPixmap_destroy(NewHandle);
|
QPixmap_destroy(NewHandle);
|
||||||
end else
|
end else
|
||||||
Context.drawPixmap(@APoint, Pixmap.Handle, @ARect);
|
Context.drawPixmap(@APoint, Pixmap, @ARect);
|
||||||
finally
|
finally
|
||||||
Pixmap.Free;
|
QPixmap_destroy(Pixmap);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user