44 #ifndef QT_NO_PRINTDIALOG 47 #include <private/qprintengine_win_p.h> 48 #include <private/qabstractpagesetupdialog_p.h> 77 memset(&psd, 0,
sizeof(PAGESETUPDLG));
78 psd.lStructSize =
sizeof(PAGESETUPDLG);
84 devModeSize =
sizeof(DEVMODE) + ep->
devMode->dmDriverExtra;
85 hDevMode = GlobalAlloc(GHND, devModeSize);
87 void *dest = GlobalLock(hDevMode);
88 memcpy(dest, ep->
devMode, devModeSize);
89 GlobalUnlock(hDevMode);
91 psd.hDevMode = hDevMode;
97 psd.hDevNames = tempDevNames;
102 psd.hwndOwner = parent ? parent->
winId() : 0;
104 psd.Flags = PSD_MARGINS;
105 double multiplier = 1;
108 psd.Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
112 psd.Flags |= PSD_INTHOUSANDTHSOFINCHES;
113 multiplier = 25.4/10;
118 psd.rtMargin.
left = marginRect.
left() / multiplier;
119 psd.rtMargin.top = marginRect.
top() / multiplier;
120 psd.rtMargin.right = marginRect.
width() / multiplier;;
121 psd.rtMargin.bottom = marginRect.
height() / multiplier;;
123 bool result = PageSetupDlg(&psd);
128 QRect theseMargins =
QRect(psd.rtMargin.left * multiplier,
129 psd.rtMargin.top * multiplier,
130 psd.rtMargin.right * multiplier,
131 psd.rtMargin.bottom * multiplier);
133 if (theseMargins != marginRect) {
135 psd.rtMargin.top * multiplier,
136 psd.rtMargin.right * multiplier,
137 psd.rtMargin.bottom * multiplier);
144 void *src = GlobalLock(hDevMode);
145 memcpy(ep->
devMode, src, devModeSize);
146 GlobalUnlock(hDevMode);
151 GlobalFree(hDevMode);
152 GlobalFree(tempDevNames);
#define QT_END_NAMESPACE
This macro expands to.
T * data() const
Returns the value of the pointer referenced by this object.
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
void readDevmode(HGLOBAL globalDevmode)
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
The QAbstractPageSetupDialog class provides a base for implementations of page setup dialogs...
int height() const
Returns the height of the rectangle.
QRect getPageMargins() const
HGLOBAL * createDevNames()
static QLocale system()
Returns a QLocale object initialized to the system locale.
QPageSetupDialog(QPrinter *printer, QWidget *parent=0)
Constructs a page setup dialog that configures printer with parent as the parent widget.
The QPageSetupDialog class provides a configuration dialog for the page-related options on a printer...
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setPageMargins(int margin_left, int margin_top, int margin_right, int margin_bottom)
The QPrinter class is a paint device that paints on a printer.
int top() const
Returns the y-coordinate of the rectangle's top edge.
QScopedPointer< QPaintEnginePrivate > d_ptr
QObject * parent() const
Returns a pointer to the parent object.
The QRect class defines a rectangle in the plane using integer precision.
void updateCustomPaperSize()
void readDevnames(HGLOBAL globalDevnames)
virtual void setVisible(bool visible)
Reimplemented Function