Qt/Qt5/Win32: fixed page size and name (qt) and page orientation mismatch under win32. Patch by Joeny Ang. issue #39449

This commit is contained in:
Željan Rikalo 2021-11-02 15:55:49 +01:00
parent 19feb31030
commit 5133009bc0
2 changed files with 17 additions and 8 deletions

View File

@ -186,6 +186,7 @@ var
if (pgSize > 30) then
{$ENDIF}
QtDefaultPrinter.PageSize := PgSize;
FPapers[i].PageSize := PgSize;
FPapers[i].PageRect := QtDefaultPrinter.PageRect;
FPapers[i].PaperRect := QtDefaultPrinter.PaperRect;
if PaperName=DEFAULT_PAPER_NAME then
@ -502,13 +503,21 @@ begin
Result := inherited DoGetPaperRect(aName,aPaperRc);
i := IndexOfPaper(aName);
if i >= 0 then
begin
{When we set QPrinter into FullPage, rect is not same
on all platforms, this is fixed with qt-4.4}
APaperRC.WorkRect := FPapers[i].PageRect;
APaperRC.PhysicalRect := FPapers[i].PaperRect;
Result := 1;
end;
with FPapers[i] do
begin
{When we set QPrinter into FullPage, rect is not same
on all platforms, this is fixed with qt-4.4}
if Orientation in [poPortrait, poReversePortrait] then begin
APaperRC.WorkRect := PageRect;
APaperRC.PhysicalRect := PaperRect;
end else begin
APaperRC.WorkRect :=
Rect(PageRect.Top, PageRect.Left, PageRect.Bottom, PageRect.Right);
APaperRC.PhysicalRect :=
Rect(PaperRect.Top, PaperRect.Left, PaperRect.Bottom, PaperRect.Right);
end;
Result := 1;
end;
end;
function TQtPrinters.DoSetPrinter(aName: string): Integer;

View File

@ -37,7 +37,7 @@ const
const
Win32Orientations: array [TPrinterOrientation] of SHORT = (
DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE, DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE);
DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE, DMORIENT_LANDSCAPE, DMORIENT_PORTRAIT);
DMPAPER_USER = 256;
type