8#include <private/qprintengine_win_p.h>
11#include <qpa/qplatformnativeinterface.h>
40 memset(&psd, 0,
sizeof(PAGESETUPDLG));
41 psd.lStructSize =
sizeof(PAGESETUPDLG);
46 if (!
engine->globalDevMode()) {
47 devModeSize =
sizeof(DEVMODE) + ep->
devMode->dmDriverExtra;
48 hDevMode = GlobalAlloc(GHND, devModeSize);
50 void *dest = GlobalLock(hDevMode);
51 memcpy(dest, ep->
devMode, devModeSize);
52 GlobalUnlock(hDevMode);
54 psd.hDevMode = hDevMode;
56 psd.hDevMode =
engine->globalDevMode();
59 HGLOBAL *tempDevNames =
engine->createGlobalDevNames();
60 psd.hDevNames = tempDevNames;
69 psd.Flags = PSD_MARGINS;
83 qreal multiplier = 1.0;
85 psd.Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
88 psd.Flags |= PSD_INTHOUSANDTHSOFINCHES;
91 psd.rtMargin.left =
layout.margins().left() * multiplier;
92 psd.rtMargin.top =
layout.margins().top() * multiplier;
93 psd.rtMargin.right =
layout.margins().right() * multiplier;
94 psd.rtMargin.bottom =
layout.margins().bottom() * multiplier;
97 bool result = PageSetupDlg(&psd);
100 engine->setGlobalDevMode(psd.hDevNames, psd.hDevMode);
104 DEVMODE *rDevmode =
reinterpret_cast<DEVMODE*
>(GlobalLock(psd.hDevMode));
105 if (rDevmode->dmFields & DM_ORIENTATION) {
106 layout.setOrientation(rDevmode->dmOrientation == DMORIENT_PORTRAIT
109 if (rDevmode->dmFields & DM_PAPERSIZE)
111 GlobalUnlock(rDevmode);
115 QSizeF unitSize(psd.ptPaperSize.x / multiplier, psd.ptPaperSize.y / multiplier);
116 if (unitSize.width() > unitSize.height()) {
118 unitSize.transpose();
125 layout.setPageSize(pageSize);
127 const QMarginsF margins(psd.rtMargin.left, psd.rtMargin.top, psd.rtMargin.right, psd.rtMargin.bottom);
128 layout.setMargins(margins / multiplier);
129 d->printer->setPageLayout(
layout);
132 if (!
engine->globalDevMode() && hDevMode) {
136 ep->
devMode = (DEVMODE *) malloc(devModeSize);
140 void *
src = GlobalLock(hDevMode);
142 GlobalUnlock(hDevMode);
146 if (!
engine->globalDevMode() && hDevMode)
147 GlobalFree(hDevMode);
148 GlobalFree(tempDevNames);
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or \nullptr if no applica...
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
The QDialog class is the base class of dialog windows.
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
virtual void done(int)
Closes the dialog and sets its result code to r.
static QPlatformNativeInterface * platformNativeInterface()
MeasurementSystem measurementSystem() const
static QLocale system()
Returns a QLocale object initialized to the system locale.
QObject * parent() const
Returns a pointer to the parent object.
QScopedPointer< QObjectData > d_ptr
The QPageSetupDialog class provides a configuration dialog for the page-related options on a printer.
QPageSetupDialog(QPrinter *printer, QWidget *parent=nullptr)
Constructs a page setup dialog that configures printer with parent as the parent widget.
int exec() override
This virtual function is called to pop up the dialog.
bool isValid() const
Returns true if this page size is valid.
PageSizeId id() const
Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
Combined button and popup list for selecting options.
app setAttribute(Qt::AA_DontShowIconsInMenus)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent