42 #ifndef QT_NO_PRINTDIALOG 44 #include <private/qt_mac_p.h> 48 #include <private/qapplication_p.h> 49 #include <private/qabstractprintdialog_p.h> 50 #include <private/qprintengine_mac_p.h> 60 #ifndef QT_MAC_USE_COCOA
64 #ifndef QT_MAC_USE_COCOA 67 DisposePMSheetDoneUPP(
upp);
72 if (it.
value() ==
this) {
81 #ifndef QT_MAC_USE_COCOA 87 qWarning(
"%s:%d: QPrintDialog::exec: Could not retrieve data structure, " 88 "you most likely now have an infinite loop", __FILE__, __LINE__);
96 void closeCocoaPrintPanel();
105 #ifndef QT_NO_MESSAGEBOX 115 #ifndef QT_MAC_USE_COCOA 125 #ifdef QT_MAC_USE_COCOA 129 @interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject {
131 - (void)printPanelDidEnd:(NSPrintPanel *)printPanel
132 returnCode:(
int)returnCode contextInfo:(
void *)contextInfo;
135 @implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate)
136 - (void)printPanelDidEnd:(NSPrintPanel *)printPanel
137 returnCode:(
int)returnCode contextInfo:(
void *)contextInfo
144 if (returnCode == NSOKButton) {
145 UInt32 frompage, topage;
165 PMDestinationType dest;
170 d->
ep->
session =
static_cast<PMPrintSession
>([d->ep->printInfo PMPrintSession]);
173 if (dest == kPMDestinationFile) {
176 UInt8 localFile[2048];
177 CFURLGetFileSystemRepresentation(file,
true, localFile,
sizeof(localFile));
214 PMSetPageRange(
ep->
settings, q->minPage(), q->maxPage());
216 PMSetFirstPage(
ep->
settings, q->fromPage(),
false);
217 PMSetLastPage(
ep->
settings, q->toPage(),
false);
221 #ifndef QT_MAC_USE_COCOA 255 UInt32 frompage, topage;
259 q->setFromTo(frompage, topage);
265 if (q->fromPage() == 1 && q->toPage() ==
INT_MAX) {
272 if (q->maxPage() < q->toPage())
273 q->setFromTo(q->fromPage(), q->maxPage());
276 PMDestinationType dest;
278 if (dest == kPMDestinationFile) {
281 UInt8 localFile[2048];
282 CFURLGetFileSystemRepresentation(file,
true, localFile,
sizeof(localFile));
297 QPrintDialog::PrintDialogOptions qtOptions = q->options();
298 NSPrintPanelOptions macOptions = NSPrintPanelShowsCopies;
300 macOptions |= NSPrintPanelShowsPageRange;
302 macOptions |= NSPrintPanelShowsPaperSize | NSPrintPanelShowsPageSetupAccessory
303 | NSPrintPanelShowsOrientation;
307 QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init];
318 qWarning(
"QPrintDialog is required to be modal on OS X");
319 int rval = [
printPanel runModalWithPrintInfo:ep->printInfo];
320 [delegate printPanelDidEnd:printPanel returnCode:rval contextInfo:this];
324 [
printPanel beginSheetWithPrintInfo:ep->printInfo
325 modalForWindow:windowRef
327 didEndSelector:@selector(printPanelDidEnd:returnCode:contextInfo:)
334 void QPrintDialogPrivate::closeCocoaPrintPanel()
343 qWarning(
"QPrintDialog: Cannot be used on non-native printers");
378 #ifndef QT_MAC_USE_COCOA 384 d->closeCocoaPrintPanel();
404 bool isCurrentlyVisible = (d->
printPanel != 0);
406 if (!visible == !isCurrentlyVisible)
413 #ifndef QT_MAC_USE_COCOA 418 : Qt::ApplicationModal);
423 #ifndef QT_MAC_USE_COCOA 426 d->closeCocoaPrintPanel();
435 #include "moc_qprintdialog.cpp" 437 #endif // QT_NO_PRINTDIALOG
void _q_printerChanged(int)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
int remove(const Key &key)
Removes all the items that have the key from the hash.
static QHash< PMPrintSession, QPrintDialogPrivate * > sheetCallbackMap
void _q_printToFileChanged(int)
#define it(className, varName)
QMacPrintEnginePrivate * ep
struct OpaqueWindowPtr * WindowRef
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
T & value() const
Returns a modifiable reference to the current item's value.
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
const T value(const Key &key) const
Returns the value associated with the key.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
OSWindowRef qt_mac_window_for(const QWidget *)
void setObjectName(const QString &name)
~QPrintDialog()
Destroys the print dialog.
static void printDialogSheetDoneCallback(PMPrintSession printSession, WindowRef, Boolean accepted)
The QPrintDialog class provides a dialog for specifying the printer's configuration.
#define QT_BEGIN_NAMESPACE
This macro expands to.
OutputFormat outputFormat() const
Returns the output format for this printer.
void _q_btnPropertiesClicked()
void macStartInterceptWindowTitle(QWidget *window)
The QPrinter class is a paint device that paints on a printer.
int fromPage() const
Returns the first page to be printed By default, this value is set to 0.
OutputFormat
The OutputFormat enum is used to describe the format QPrinter should use for printing.
void _q_chbPrintLastFirstToggled(bool)
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
static bool warnIfNotNative(QPrinter *printer)
int toPage() const
Returns the last page to be printed.
Q_CORE_EXPORT void qWarning(const char *,...)
QPrintDialog * printDialog()
void setFromTo(int fromPage, int toPage)
Sets the range in the print dialog to be from from to to.
int exec()
Reimplemented Function
int maxPage() const
Returns the maximum page in the page range.
void done(int result)
Closes the dialog and sets its result code to result.
The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure pri...
#define Q_DECLARE_PUBLIC(Class)
QPaintEngine * paintEngine() const
Returns the paint engine used by the printer.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
#define QT_MANGLE_NAMESPACE(name)
QObject * parent() const
Returns a pointer to the parent object.
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
QPrinter * printer()
Returns the printer that this printer dialog operates on.
static bool native_modal_dialog_active
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
void setVisible(bool visible)
Reimplemented Function
void setPrintRange(PrintRange range)
Sets the print range option in to be range.
void openCarbonPrintPanel(Qt::WindowModality modality)
void setOutputFormat(OutputFormat format)
Sets the output format for this printer to format.
void closeCarbonPrintPanel()
void _q_btnBrowseClicked()
void _q_paperSizeChanged(int)
static void leaveModal(QWidget *)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void macStopInterceptWindowTitle()
void _q_rbPrintRangeToggled(bool)
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
QPrintDialog(QPrinter *printer, QWidget *parent=0)
Constructs a new modal printer dialog for the given printer with the given parent.
static void enterModal(QWidget *)
NSPrintPanel * printPanel
void setOutputFileName(const QString &)
Sets the name of the output file to fileName.