summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp4
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp11
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp44
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp186
-rw-r--r--src/printsupport/kernel/qprintengine_win_p.h1
-rw-r--r--src/printsupport/kernel/qprinter.cpp32
-rw-r--r--src/printsupport/kernel/qprinter.h7
-rw-r--r--src/printsupport/printsupport.pro1
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp7
9 files changed, 187 insertions, 106 deletions
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index 6f96a499e5..b5dc2d016a 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -54,8 +54,8 @@
#if !defined(PD_NOCURRENTPAGE)
#define PD_NOCURRENTPAGE 0x00800000
-#define PD_RESULT_PRINT 1
-#define PD_RESULT_APPLY 2
+#define PD_RESULT_PRINT 1
+#define PD_RESULT_APPLY 2
#define START_PAGE_GENERAL 0XFFFFFFFF
#endif
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index 4692fb5c3c..c0c8a759aa 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -65,6 +65,15 @@
#ifndef QT_NO_PRINTPREVIEWDIALOG
+static void initResources()
+{
+ static bool resourcesInitialized = false;
+ if (!resourcesInitialized) {
+ Q_INIT_RESOURCE(qprintdialog);
+ resourcesInitialized = true;
+ }
+}
+
QT_BEGIN_NAMESPACE
namespace {
@@ -217,6 +226,8 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
{
Q_Q(QPrintPreviewDialog);
+ initResources();
+
if (_printer) {
preview = new QPrintPreviewWidget(_printer, q);
printer = _printer;
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index 7b3c3c1dac..6c65300462 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -147,6 +147,28 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
Q_D(QPdfPrintEngine);
switch (int(key)) {
+
+ // The following keys are properties or derived values and so cannot be set
+ case PPK_PageRect:
+ break;
+ case PPK_PaperRect:
+ break;
+ case PPK_PaperSources:
+ break;
+ case PPK_SupportsMultipleCopies:
+ break;
+ case PPK_SupportedResolutions:
+ break;
+
+ // The following keys are settings that are unsupported by the PDF PrintEngine
+ case PPK_CustomBase:
+ break;
+ case PPK_PaperName:
+ break;
+ case PPK_WindowsPageSize:
+ break;
+
+ // The following keys are properties and settings that are supported by the PDF PrintEngine
case PPK_CollateCopies:
d->collate = value.toBool();
break;
@@ -216,8 +238,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->pageMarginsSet = true;
break;
}
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
}
@@ -227,6 +248,20 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
QVariant ret;
switch (int(key)) {
+
+ // The following keys are settings that are unsupported by the PDF PrintEngine
+ // Return sensible default values to ensure consistent behavior across platforms
+ case PPK_CustomBase:
+ // Special case, leave null
+ break;
+ case PPK_PaperName:
+ ret = QString();
+ break;
+ case PPK_WindowsPageSize:
+ // Special case, leave null
+ break;
+
+ // The following keys are properties and settings that are supported by the PDF PrintEngine
case PPK_CollateCopies:
ret = d->collate;
break;
@@ -307,8 +342,7 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
ret = margins;
break;
}
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
return ret;
}
@@ -352,7 +386,7 @@ void QPdfPrintEnginePrivate::closePrintDevice()
QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)
: QPdfEnginePrivate(),
duplex(QPrinter::DuplexNone),
- collate(false),
+ collate(true),
copies(1),
pageOrder(QPrinter::FirstPageFirst),
paperSource(QPrinter::Auto),
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 6fa75338aa..74484bfc8c 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -182,7 +182,7 @@ static const struct {
int winSourceName;
QPrinter::PaperSource qtSourceName;
} sources[] = {
- { DMBIN_ONLYONE, QPrinter::OnlyOne },
+ { DMBIN_UPPER, QPrinter::Upper }, // = DBMIN_ONLYONE
{ DMBIN_LOWER, QPrinter::Lower },
{ DMBIN_MIDDLE, QPrinter::Middle },
{ DMBIN_MANUAL, QPrinter::Manual },
@@ -195,6 +195,7 @@ static const struct {
{ DMBIN_LARGECAPACITY, QPrinter::LargeCapacity },
{ DMBIN_CASSETTE, QPrinter::Cassette },
{ DMBIN_FORMSOURCE, QPrinter::FormSource },
+ { DMBIN_USER, QPrinter::CustomSource },
{ 0, (QPrinter::PaperSource) -1 }
};
@@ -234,7 +235,6 @@ QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode)
| PaintOutsidePaintEvent))
{
Q_D(QWin32PrintEngine);
- d->docName = QLatin1String("document1");
d->mode = mode;
d->queryDefault();
d->initialize();
@@ -269,7 +269,10 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
DOCINFO di;
memset(&di, 0, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
- di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
+ if (d->docName.isEmpty())
+ di.lpszDocName = L"document1";
+ else
+ di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
if (d->printToFile && !d->fileName.isEmpty())
di.lpszOutput = reinterpret_cast<const wchar_t *>(d->fileName.utf16());
if (ok && StartDoc(d->hdc, &di) == SP_ERROR) {
@@ -1093,6 +1096,7 @@ void QWin32PrintEnginePrivate::initialize()
if (devMode) {
num_copies = devMode->dmCopies;
+ devMode->dmCollate = DMCOLLATE_TRUE;
}
initHDC();
@@ -1270,6 +1274,35 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
{
Q_D(QWin32PrintEngine);
switch (key) {
+
+ // The following keys are properties or derived values and so cannot be set
+ case PPK_PageRect:
+ break;
+ case PPK_PaperRect:
+ break;
+ case PPK_PaperSources:
+ break;
+ case PPK_SupportsMultipleCopies:
+ break;
+ case PPK_SupportedResolutions:
+ break;
+
+ // The following keys are settings that are unsupported by the Windows PrintEngine
+ case PPK_CustomBase:
+ break;
+ case PPK_Duplex:
+ // TODO Add support using DEVMODE.dmDuplex
+ break;
+ case PPK_FontEmbedding:
+ break;
+ case PPK_PageOrder:
+ break;
+ case PPK_PrinterProgram:
+ break;
+ case PPK_SelectionOption:
+ break;
+
+ // The following keys are properties and settings that are supported by the Windows PrintEngine
case PPK_CollateCopies:
{
if (!d->devMode)
@@ -1289,7 +1322,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
case PPK_Creator:
-
+ d->m_creator = value.toString();
break;
case PPK_DocumentName:
@@ -1344,33 +1377,31 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
setDevModePaperFlags(d->devMode, d->has_custom_paper_size);
d->doReinit();
break;
+
case PPK_PaperName:
{
if (!d->devMode)
break;
- DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERNAMES, NULL, NULL);
+ const wchar_t *name = reinterpret_cast<const wchar_t*>(d->name.utf16());
+ DWORD size = DeviceCapabilities(name, NULL, DC_PAPERNAMES, NULL, NULL);
if ((int)size > 0) {
- wchar_t *paperNames = new wchar_t[size*64];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERNAMES, paperNames, NULL);
+ QScopedArrayPointer<wchar_t> paperNames(new wchar_t[size*64]);
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERNAMES, paperNames.data(), NULL))
+ break;
int paperPos = -1;
- for (int i=0;i<(int)size;i++) {
- wchar_t *copyOfPaper = paperNames + (i * 64);
+ for (int i = 0; i < (int)size; ++i) {
+ wchar_t *copyOfPaper = paperNames.data() + (i * 64);
if (value.toString() == QString::fromWCharArray(copyOfPaper, qwcsnlen(copyOfPaper, 64))) {
paperPos = i;
break;
}
}
- delete [] paperNames;
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERS, NULL, NULL);
+ size = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL);
if ((int)size > 0) {
- wchar_t *papers = new wchar_t[size];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERS, papers, NULL);
+ QScopedArrayPointer<wchar_t> papers(new wchar_t[size]);
+ size = DeviceCapabilities(name, NULL, DC_PAPERS, papers.data(), NULL);
QScopedArrayPointer<POINT> paperSizes(new POINT[size]);
- DWORD paperNameCount = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
+ DWORD paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
if (paperNameCount == size) {
const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, d->resolution);
d->paper_size = QSizeF((paperSizes[paperPos].x / 10.0) * multiplier, (paperSizes[paperPos].y / 10.0) * multiplier);
@@ -1381,8 +1412,6 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
setDevModePaperFlags(d->devMode, false);
d->doReinit();
}
-
- delete [] papers;
}
}
}
@@ -1418,15 +1447,6 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
}
break;
- case PPK_SelectionOption:
-
- break;
-
- case PPK_SupportedResolutions:
-
- break;
-
-
case PPK_WindowsPageSize:
if (!d->devMode)
break;
@@ -1470,9 +1490,9 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageMargins(left, top, right, bottom);
break;
}
- default:
- // Do nothing
- break;
+
+ // No default so that compiler will complain if new keys added and not handled in this engine
+
}
}
@@ -1482,9 +1502,29 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
QVariant value;
switch (key) {
- case PPK_CollateCopies:
+ // The following keys are settings that are unsupported by the Windows PrintEngine
+ // Return sensible default values to ensure consistent behavior across platforms
+ case PPK_Duplex:
+ // TODO Add support using DEVMODE.dmDuplex
+ value = QPrinter::DuplexNone;
+ break;
+ case PPK_FontEmbedding:
value = false;
break;
+ case PPK_PageOrder:
+ value = QPrinter::FirstPageFirst;
+ break;
+ case PPK_PrinterProgram:
+ value = QString();
+ break;
+ case PPK_SelectionOption:
+ value = QString();
+ break;
+
+ // The following keys are properties and settings that are supported by the Windows PrintEngine
+ case PPK_CollateCopies:
+ value = d->devMode->dmCollate == DMCOLLATE_TRUE;
+ break;
case PPK_ColorMode:
{
@@ -1496,6 +1536,10 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
}
break;
+ case PPK_Creator:
+ value = d->m_creator;
+ break;
+
case PPK_DocumentName:
value = d->docName;
break;
@@ -1569,40 +1613,37 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
value = QTransform(1/d->stretch_x, 0, 0, 1/d->stretch_y, 0, 0).mapRect(d->devPaperRect);
}
break;
+
case PPK_PaperName:
if (!d->devMode) {
value = QLatin1String("A4");
} else {
- DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERS, NULL, NULL);
+ const wchar_t *name = reinterpret_cast<const wchar_t*>(d->name.utf16());
+ DWORD size = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL);
int paperSizePos = -1;
if ((int)size > 0) {
- wchar_t *papers = new wchar_t[size];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERS, papers, NULL);
+ QScopedArrayPointer<wchar_t> papers(new wchar_t[size]);
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERS, papers.data(), NULL))
+ break;
for (int i=0;i<(int)size;i++) {
if (papers[i] == d->devMode->dmPaperSize) {
paperSizePos = i;
break;
}
}
- delete [] papers;
-
}
if (paperSizePos != -1) {
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERNAMES, NULL, NULL);
+ size = DeviceCapabilities(name, NULL, DC_PAPERNAMES, NULL, NULL);
if ((int)size > 0) {
- wchar_t *papers = new wchar_t[size*64];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
- NULL, DC_PAPERNAMES, papers, NULL);
- wchar_t *copyOfPaper = papers + (paperSizePos * 64);
+ QScopedArrayPointer<wchar_t> paperNames(new wchar_t[size*64]);
+ size = DeviceCapabilities(name, NULL, DC_PAPERNAMES, paperNames.data(), NULL);
+ wchar_t *copyOfPaper = paperNames.data() + (paperSizePos * 64);
value = QString::fromWCharArray(copyOfPaper, qwcsnlen(copyOfPaper, 64));
- delete [] papers;
}
}
}
break;
+
case PPK_PaperSource:
if (!d->devMode) {
value = QPrinter::Auto;
@@ -1677,9 +1718,9 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
value = margins;
break;
}
- default:
- // Do nothing
- break;
+
+ // No default so that compiler will complain if new keys added and not handled in this engine
+
}
return value;
}
@@ -1705,16 +1746,14 @@ QList<QPrinter::PaperSize> QWin32PrintEngine::supportedPaperSizes(const QPrinter
if (printerInfo.isNull())
return returnList;
-
- DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t *>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERS, NULL, NULL);
+ const wchar_t *name = reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16());
+ DWORD size = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL);
if ((int)size != -1) {
- wchar_t *papers = new wchar_t[size];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t *>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERS, papers, NULL);
+ QScopedArrayPointer<wchar_t> papers(new wchar_t[size]);
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERS, papers.data(), NULL))
+ return returnList;
for (int c = 0; c < (int)size; ++c)
returnList.append(mapDevmodePaperSize(papers[c]));
- delete [] papers;
}
return returnList;
}
@@ -1724,27 +1763,22 @@ QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const
QList<QPair<QString, QSizeF> > paperSizes;
if (printerInfo.isNull())
return paperSizes;
- DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERNAMES, NULL, NULL);
+ const wchar_t *name = reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16());
+ DWORD size = DeviceCapabilities(name, NULL, DC_PAPERNAMES, NULL, NULL);
if ((int)size > 0) {
- wchar_t *papers = new wchar_t[size*64];
- size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERNAMES, papers, NULL);
- DWORD size2 = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERSIZE, NULL, NULL);
- if ((int)size2 > 0) {
- POINT *points = new POINT[size2*sizeof(POINT)];
-
- size2 = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()),
- NULL, DC_PAPERSIZE, (wchar_t *)points, NULL);
- for (int i=0;i<(int)size;i++) {
- wchar_t *paper = papers + (i * 64);
- QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64));
- paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0));
- }
- delete [] points;
+ QScopedArrayPointer<wchar_t> papers(new wchar_t[size*64]);
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERNAMES, papers.data(), NULL))
+ return paperSizes;
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL))
+ return paperSizes;
+ QScopedArrayPointer<POINT> points(new POINT[size*sizeof(POINT)]);
+ if (size != DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)points.data(), NULL))
+ return paperSizes;
+ for (int i = 0; i < (int)size; ++i) {
+ wchar_t *paper = papers.data() + (i * 64);
+ QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64));
+ paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0));
}
- delete [] papers;
}
return paperSizes;
}
diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h
index 93fe993088..040140d50f 100644
--- a/src/printsupport/kernel/qprintengine_win_p.h
+++ b/src/printsupport/kernel/qprintengine_win_p.h
@@ -210,6 +210,7 @@ public:
// Document info
QString docName;
+ QString m_creator;
QString fileName;
QPrinter::PrinterState state;
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index f23708045d..496883f44b 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -226,7 +226,6 @@ void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinte
prop = QVariant(q_ptr->copyCount());
else if (key != QPrintEngine::PPK_PrinterName)
prop = oldPrintEngine->property(key);
-
if (prop.isValid())
setProperty(key, prop);
}
@@ -516,12 +515,15 @@ void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, cons
\value LargeCapacity
\value LargeFormat
\value Lower
- \value MaxPageSource
+ \value MaxPageSource Deprecated, use LastPaperSource instead
\value Middle
\value Manual
\value OnlyOne
\value Tractor
\value SmallFormat
+ \value Upper
+ \value CustomSource A PaperSource defined by the printer that is unknown to Qt
+ \value LastPaperSource The highest valid PaperSource value, currently CustomSource
*/
/*!
@@ -936,11 +938,9 @@ QPrinter::Orientation QPrinter::orientation() const
The printer driver reads this setting and prints using the
specified orientation.
- On Windows, this option can be changed while printing and will
+ On Windows and Mac, this option can be changed while printing and will
take effect from the next call to newPage().
- On Mac OS X, changing the orientation during a print job has no effect.
-
\sa orientation()
*/
@@ -1824,11 +1824,17 @@ QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const
Any other value implies that the given value should be used.
- \warning This function is not available on Windows.
+ This function always returns an empty string on Windows and Mac.
- \sa setPrinterSelectionOption()
+ \sa setPrinterSelectionOption(), setPrintProgram()
*/
+QString QPrinter::printerSelectionOption() const
+{
+ Q_D(const QPrinter);
+ return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
+}
+
/*!
\fn void QPrinter::setPrinterSelectionOption(const QString &option)
@@ -1840,24 +1846,16 @@ QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const
If the printer selection option is changed while the printer is
active, the current print job may or may not be affected.
- \warning This function is not available on Windows.
+ This function has no effect on Windows or Mac.
- \sa printerSelectionOption()
+ \sa printerSelectionOption(), setPrintProgram()
*/
-#ifndef Q_OS_WIN
-QString QPrinter::printerSelectionOption() const
-{
- Q_D(const QPrinter);
- return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
-}
-
void QPrinter::setPrinterSelectionOption(const QString &option)
{
Q_D(QPrinter);
d->setProperty(QPrintEngine::PPK_SelectionOption, option);
}
-#endif
/*!
\since 4.1
diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h
index 2528157532..679f3af043 100644
--- a/src/printsupport/kernel/qprinter.h
+++ b/src/printsupport/kernel/qprinter.h
@@ -103,7 +103,10 @@ public:
LargeCapacity,
Cassette,
FormSource,
- MaxPageSource
+ MaxPageSource, // Deprecated
+ CustomSource,
+ LastPaperSource = CustomSource,
+ Upper = OnlyOne // As defined in Windows
};
enum PrinterState { Idle,
@@ -222,10 +225,8 @@ public:
QRectF paperRect(Unit) const;
QRectF pageRect(Unit) const;
-#if !defined(Q_OS_WIN) || defined(Q_QDOC)
QString printerSelectionOption() const;
void setPrinterSelectionOption(const QString &);
-#endif
bool newPage();
bool abort();
diff --git a/src/printsupport/printsupport.pro b/src/printsupport/printsupport.pro
index ee4f9f72df..a92d36f7bc 100644
--- a/src/printsupport/printsupport.pro
+++ b/src/printsupport/printsupport.pro
@@ -1,6 +1,7 @@
TARGET = QtPrintSupport
QT = core-private gui-private widgets-private
+MODULE_CONFIG = needs_printsupport_plugin
DEFINES += QT_NO_USING_NAMESPACE
QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf
diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp
index f788663041..3ef1e882fe 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.cpp
+++ b/src/printsupport/widgets/qprintpreviewwidget.cpp
@@ -162,9 +162,10 @@ signals:
protected:
void resizeEvent(QResizeEvent* e)
{
- const bool blocked = verticalScrollBar()->blockSignals(true); // Don't change page, QTBUG-14517
- QGraphicsView::resizeEvent(e);
- verticalScrollBar()->blockSignals(blocked);
+ {
+ const QSignalBlocker blocker(verticalScrollBar()); // Don't change page, QTBUG-14517
+ QGraphicsView::resizeEvent(e);
+ }
emit resized();
}