summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Fix some warnings about deprecated functions not under testFriedemann Kleint2019-05-271-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings like: baselineserver/shared/baselineprotocol.cpp:295:72: warning: ‘int QImage::byteCount() const’ is deprecated: Use sizeInBytes [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:17: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:39: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:8153:60: warning: ‘T* QWeakPointer<T>::data() const [with T = const QNetworkSession]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]. ... st_qprinter.cpp:1318:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_qprinter.cpp:1362:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_largefile.cpp:492:85: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_largefile.cpp:498:91: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_qabstractitemmodel.cpp:312:25: warning: ‘void QAbstractItemModel::reset()’ is deprecated [-Wdeprecated-declarations] ... tst_qabstractitemmodel.cpp:1793:28: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations] ... tst_qcolor.cpp:1425:33: warning: ‘QColor QColor::light(int) const’ is deprecated: Use QColor::lighter() instead [-Wdeprecated-declarations] tst_qcolor.cpp:1432:31: warning: ‘QColor QColor::dark(int) const’ is deprecated: Use QColor::darker() instead [-Wdeprecated-declarations] tst_qprinterinfo.cpp:303:61: warning: 'QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const' is deprecated [-Wdeprecated-declarations] tst_qprinterinfo.cpp:304:65: warning: 'QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const' is deprecated [-Wdeprecated-declarations] tst_qtextdocumentfragment.cpp:947:52: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] tst_qtextlayout.cpp:2261:61: warning: ‘void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>&)’ is deprecated: Use setFormats() [-Wdeprecated-declarations] tst_qtextlayout.cpp:2330:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] tst_qitemselectionmodel.cpp:2214:37: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] ... tst_qtextlist.cpp:317:68: warning: 'bool QTextList::isEmpty() const' is deprecated: Use count() instead [-Wdeprecated-declarations] tst_qpainter.cpp:373:32: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:374:40: warning: ‘bool QPainter::matrixEnabled() const’ is deprecated: Use worldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:702:45: warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] tst_qpainter.cpp:1573:29: warning: ‘void QPainter::drawRoundRect(const QRect&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:76:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:81:41: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:105:30: warning: ‘virtual void QPdfWriter::setMargins(const QPagedPaintDevice::Margins&)’ is deprecated: Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:172:37: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:258:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp:3980:54: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] tst_qlocale.cpp:434:26: warning: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] ... Change-Id: I77c1a934b27119eedeb26a77c913686314a2a5c7 Reviewed-by: David Faure <david.faure@kdab.com>
* tst_QPrinter: stabilize qprinter testChristian Ehrlicher2019-01-201-1/+1
| | | | | | | | | | | The CreationDate entry in the two PDF files can potentially be different depending on when the test is run. 97b4c5a5746a33a27076d72ceb3533fbd54b9642 already accounts for it but the current tag for creation date is '/CreationDate'. Therefore check if the line contains 'CreationDate' instead. Change-Id: I1fc069cf935bba07084ac4a0743ff05312374d10 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-031-0/+45
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
| * If the page size is not valid on the new printer, set a custom sizeAndy Shaw2018-05-021-0/+45
| | | | | | | | | | | | | | | | | | | | | | When the page size was not valid on the new printer, it would end up having the wrong page size name on the new printer. What should happen in this case is that it should set the originally set page size as a custom page size on the printer instead. Task-number: QTBUG-62221 Change-Id: Iaca34ae262f5d0685ca60e4ca4b38229a2283289 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-101-1/+5
|\| | | | | | | Change-Id: I0120f804522c0c652e9537b6e9fe08189f071ed2
| * tst_QPrinter: Use qWaitForWindowActive() to wait for dialogKari Oikarinen2018-04-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of an unconditional wait. The QSKIP is necessary because the PDF format is non-native and the Windows implementation of QPrintDialog doesn't work then. The macOS implementation has the same warning, so add the check for that OS as well. The test has previously passed, since it hasn't seen not actually opening the dialog as an issue. Change-Id: Ib53e378b232580358f13e0c5206404412f9e6ee2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Move duplex member from QPdfPrintEnginePrivate to QCupsPrintEnginePrivateAlbert Astals Cid2018-02-201-2/+2
|/ | | | | | | | Duplex doesn't really make sense in the context of printing to pdf, and the variable was only being used in QCupsPrintEnginePrivate anyway Change-Id: I801634c56759572825b5c9549d7a1dc92e5697a0 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Convert features.completer to QT_[REQUIRE_]CONFIGStephan Binner2017-09-041-2/+2
| | | | | Change-Id: If45a46c08b37d245229a39f3d6ffbb34154934f2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* tst_QPrinter: Share printers in testPageRectAndPaperRect/testMarginFriedemann Kleint2017-08-231-64/+68
| | | | | | | | Speeds up testing by a factor of 2. Task-number: QTBUG-61827 Change-Id: I9d6c9d9786d35af3083bc7e98beb9a79dbcc7e11 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* tst_QPrinter: Disambiguate all file namesFriedemann Kleint2017-08-231-38/+25
| | | | | | | | | | | Introduce helper function which uses a number to build unique names. Remove helper for deleting files since it now uses a temporary directory. Add a few cases that were overlooked in 88c68f4d9ed649f444bb22c52595da71ce4aac4e. Task-number: QTBUG-61827 Change-Id: I53355f99ffc3bfe6ad6994a5439710c9fa8cdad5 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* tst_QPrinter: Run in temporary directoryFriedemann Kleint2017-07-031-27/+32
| | | | | Change-Id: I299b740a43926e4af31c70aadda882f87ba9c362 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Convert features.filedialog to QT_[REQUIRE_]CONFIGStephan Binner2017-06-291-2/+2
| | | | | Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-291-1/+18
|\ | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qprocess/tst_qprocess.cpp Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
| * QMacPrintEngine: Really set the printer resolutionKai Pastor2016-02-251-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | As already reported in 2009 (Qt 4.6) QPrinter never actually set the printer resolution. This change adds the necessary call to PMPrinterSetOutputResolution (available since OS X 10.5). [ChangeLog][QtPrintSupport][OS X] QMacPrintEngine now really sets the printer resolution. Task-number: QTBUG-7000 Change-Id: I3e851b62e1a7ed78564a8a6fd576b0a18d7eff63 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-211-17/+12
|/ | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix tst_QPrinter::doubleSidedPrinting() test and remove from blacklistAndy Shaw2015-11-061-4/+4
| | | | | Change-Id: If96471ed3324795086c5ff951d9332a0e82870ea Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Various tests: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-07-281-3/+3
| | | | | | | | | | | | | | - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. in tests/auto/other, tests/auto/printsupport and tests/auto/xml. Change-Id: I28cbdc89d36791f179425f17f90b697c60660938 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Fix QPrinter::setPaperSize regression when using QPrinter::DevicePixelDavid Faure2015-01-191-1/+11
| | | | | | | | | | | The QPageSize-based refactoring led to casting DevicePixel to a QPageSize::Unit value of 6 (out of bounds). And then the switch in qt_nameForCustomSize would leave the string empty, leading to "QString::arg: Argument missing: , 672" warnings. Change-Id: I85e97174cc8ead9beccaaa3ded6edfad80f8e360 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* Change bugreports.qt-project.org -> bugreports.qt.ioAlex Blasche2014-12-181-1/+1
| | | | | | | The Qt bug tracker URL changes as part of the qt.io transition Change-Id: Icb4ab198943b93639b5e3a8d99262303785c6459 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Make it possible to disable font embeddingEskil Abrahamsen Blomfeldt2014-11-151-15/+5
| | | | | | | | | | | | | | | | When font embedding is explicitly disabled, fall back to painter paths as we would if the font prohibits embedding. Note that this flag was never respected on any platform in any version of Qt, as far as I've been able to tell, because the handling of it in the X11 print engine was removed shortly after it was introduced in 2005. [ChangeLog][Printing] Disabling font embedding is now possible using the QPrinter::setFontEmbedding() function. Task-number: QTBUG-41943 Change-Id: Ice5e893f9893c5243310ae7892bec7497dd55c4a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Fix DuplexMode on all platformsJohn Layt2014-10-241-20/+26
| | | | | | | | | | | | | Add support to get/set the DuplexMode on Windows and Mac, improve the CUPS duplex handling, ensure support is the same on all platforms. [ChangeLog][QtPrintSupport][QPrinter] Added duplex support for Windows and OS X. Task-number: QTBUG-11332 Change-Id: I9d61d63233d828c3b1fd6df54072c6049f3c6298 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QPrinter - Expect failure of QPrinter page size testJohn Layt2014-03-171-1/+4
| | | | | | | | | | The page size test can get confused when two printer papers have the same size, but the code being tested is actaully correct. Put a temp QEXPECT_FAIL on the test and some debug statements so we can see why it fails and fix the test as required. Change-Id: I160ba2ed7344500d89bdcb9bb416863713fef84b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Fix winPageSize() on Mac and LinuxJohn Layt2014-03-171-13/+17
| | | | | | | | | Using QPageSize internally provides the Windows ID on all platforms so remove the conditional compile on the QPrinter api and add support to the print engines. Change-Id: I31e23d5090a9b6ceb087c29dead050b0ee1855a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Use QPageSize and QPageLayoutJohn Layt2014-03-171-104/+54
| | | | | | | | | | | | | | | | | Use QPageSize and QPageMargins to get/set values in the print engines, add api to directly set the values, and rewrite the docs to make the paper-based api obsolete instead of the page-based api. Add new PPK keys to pass QPageSize, QPageMargins and QPageLayout to the print engines to ensure no level of detail is lost, e.g. for custom sizes passed to QPrinter. [ChangeLog][QtPrintSupport][QPrinter] QPrinter can now use QPageSize and QPageLayout in the public api to control the page layout for a print job. Change-Id: Iee39a4042bcd6141d29b0a82b49066d7a7a78120 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Switch Windows to QPlatformPrintDeviceJohn Layt2014-03-171-39/+8
| | | | | | | | | | Change the Windows QPrintEngine implementation to use the QPlatformPrintDevice to obtain device information, and use QPageSize to obtain page size conversions. A following change will use QPageLayout to store that page size. Change-Id: I990943e2b62ab6dab2c4d4a292c7ed7261beadf2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinterInfo - Switch to QPlatformPrintDeviceJohn Layt2014-03-171-3/+5
| | | | | | | | | | | | | | | | | | | Change the QPrinterInfo implementation to use QPlatformPrintDevice as the backend. Remove all the old QPrinterInfo related code from the QPA plugin. Add public api to QPrinterInfo to support some features from QPlatformPrintDevice. [ChangeLog][QtPrintSupport][QPrinterInfo] Added new public api for isRemote(), state(), defaultPageSize(), supportedPageSizes(), supportsCustomPageSizes(), minimumPhysicalPageSize(), maximumPhysicalPageSize(), supportedResolutions(), availablePrinterNames(), and defaultPrinterName(). The use of availablePrinters() is discouraged due to performance concerns. Task-number: QTBUG-35248 Change-Id: Ic38323a930549ad67bf04a1a6bb43d623dfe6a33 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Add page metric testsJohn Layt2014-03-171-64/+220
| | | | | | | | | | | | | Add more page metrics tests to expose the many bugs and inconsistencies in the page layout handling. No platform or pdf backend passes all these tests so they are skipped for now, but following commits will use the tests to ensure the re-write of the page layout handling fixes the many problems in a consistent way for all backends. Change-Id: Ic5b16aa08dfe2bd9a9191662fd2bbe6b913e15c9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* QPrinter - Add more testsJohn Layt2014-02-261-6/+25
| | | | | | | Add more missing tests. Change-Id: I801c5c67731075ccb3e62377c0eccc420e708365 Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* QPrinter - Fix Printer Selection option on WindowsJohn Layt2014-02-051-5/+3
| | | | | | | | | Make the printer selection option api public on Windows to be consistent with Mac, and with the print program api which is already public. Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngne - Fix PPK_CreatorJohn Layt2014-02-051-5/+2
| | | | | | | | Add support to the Mac and Windows print engines to preserve the creator name when switching between native and pdf format. Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Fix PPK_CollateCopiesJohn Layt2014-02-051-17/+14
| | | | | | | | | | | | | | | | | Mac supports Collate Copies using native api, so add support. Note this is mostly only useful for setting the print dialog default, as Mac supports server-side multiple copies so the app will never need to collate the copies itself. Change PDF and Windows to default to collate true to match Mac as this is the behavior users expect. Task-number: QTBUG-27724 Task-number: QTBUG-35251 Task-number: QTBUG-22144 Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Fix PPK_DocumentNameJohn Layt2014-02-051-9/+2
| | | | | | | | | | | | | | | | Add support to the Mac print engine for set/get the Document Name using the Job Name setting. Our documentation states this is one use that the document name will be put to so is appropriate to be used. Change the Windows print engine to default to a blank Docuemnt Name consistent with the other print engines. If still blank when printing then use a default value. Task-number: QTBUG-27724 Task-number: QTBUG-22144 Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Clean up Print Engine Key defaults and testsJohn Layt2014-02-051-407/+1009
| | | | | | | | | | | | | | | | | | | | The PrintEngine keys are not consistently treated across the platforms and are not properly tested. Start the process of making the print engines behave consistently by documenting and testing the current behavior. Ensure all unsupported features return a consistent default value. The auto test for valuePreservation() has been flaky depending on the platform and installed printers so remove it and replace it with more complete testing. If no native printers available then don't test the native engines. Fixes for the individual inconsistent keys will follow. Task-number: QTBUG-26430 Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Fix OutputFormat when no printersJohn Layt2013-11-291-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the QPrinter constructor, setOutputFormat() and setPrinterName() make bad assumptions about the availability of printers when configuring NativeFormat which can lead to inconsistent print engine set-ups leading to crashes in the print dialog, especially on Windows where a valid DEVMODE is needed. This change cleans up the init and methods to ensure NativeFormat can only ever be set if we have both a valid plugin and a valid printer, if not the PdfFormat is used. One side-effect of this is that it is now impossible to set an invalid printer name via QPrinter (but still able to be done via QPrintEngine if really needed). Also if no default printer is set then use the first available one. This also fixes a bug where setting a new printer name on Windows reset all the saved settings. [ChangeLog][Important Behavior Changes] QPrinter no longer allows you to set an invalid printer name. Task-number: QTBUG-34345 Task-number: QTBUG-26008 Task-number: QTBUG-26430 Change-Id: I19737e4209d8c8df5817ea83246b3dd0c483ee85 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Match up the specified paper size to an existing one if possibleAndy Shaw2013-11-141-2/+77
| | | | | | | | | | | | | | | When EnumForms was used then the dmPaperSize was not always correct for the custom paper sizes available on some printers. By using DeviceCapabilities we can be sure that the information is correct in this respect. This also fixes respecting of the custom paper size if one is given and there is no corresponding existing paper size for it. Task-number: QTBUG-34276 Change-Id: I9924d5be8527027fc434261e37f6c7aae66210c3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* When calling setPageSizeMM then the size needs to be passed as MMAndy Shaw2013-09-231-0/+1
| | | | | | | | This simplifies the code a bit and ensures that it is respecting what the relevant function expects the size to be as. Change-Id: Iec88fab84c27a33d6f1a9e9413ea6beb0a39c68d Reviewed-by: John Layt <jlayt@kde.org>
* QPrintPreviewDialog: Prevent changing of page in resize handling.Friedemann Kleint2013-05-231-0/+46
| | | | | | | Task-number: QTBUG-14517 Change-Id: I59e444eed8d44be9fb7213fdbab4be473d595be8 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* QPagedPaintDevice: Fix setPageSize() to set correct metricsJohn Layt2013-04-121-0/+38
| | | | | | | | | | Use the correct metrics for the requested PageSize instead of always defaulting to A4. Task-number: QTBUG-30494 Change-Id: Ia3978afe3f7cc9b1ded1065416e5c3def44e7a05 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Tests: Remove declaration of built-in and automatic metatypes.Stephen Kelly2013-01-061-1/+0
| | | | | | | | These types are either built-in or 'automatically declared' and so don't need to be explicitly declared as metatypes. Change-Id: Ifd116dee32a450ff89a9a1011e26b434765d6e95 Reviewed-by: David Faure <david.faure@kdab.com>
* Only use the user set page margins for custom paperAndy Shaw2012-10-301-0/+59
| | | | | | | | | | | | | | When the QPrinter is initalized then it will set up page margins based on the default paper size. If the paper size is changed to be a custom one then it should disregard the margins for the default paper size. If the page margins are set explicitly beforehand then it will use these page margins. Change-Id: Ic535c3a80b8b217dbd5eb5f4fb2cbc0ab1354563 Reviewed-by: Titta Heikkala <titta.heikkala@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Revert a change to printer orientationTitta Heikkala2012-10-151-6/+6
| | | | | | | | | | | | | | | Reverting change: Ia6bc9ae14d79a646e61bfc97652f9f5af90738b3 The previous change does not set the printer correctly. It looks based on the tests that the correct printer is set, but in reality the default printer is used (even though printerName() is returning the printer set). Updated taskQTBUG4497_reusePrinterOnDifferentFiles() test case so that it generates PDF instead of PS. Testing the binary output can't be guaranteed to work in this case. Change-Id: Iee111f2c2dec84f86344a38816c21e191f5373ea Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* QtPrintSupport: allow slight deviations from pre-defined paper sizes in testsTeemu Katajisto2012-09-261-4/+4
| | | | | | | | | | CUPS paper sizes may differ from Qt paper sizes slightly and thus fail the strict comparison in qprinter tests. This is needed for the followup patch which initializes the cupsplugin with CUPS/PPD defaults. Change-Id: Ie66f77ead0204de0fc7c7913005fa516d57d34eb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Test: Redo remove QSKIP from printsupport testsCaroline Chao2012-09-131-0/+18
| | | | | | | | | | | | Redoing 5704cbc462ad0b316a6b55a0f1dadc3c50762ef This can't work, because the define comes from qconfig.h, not qmake. Skipping initTestCase and cleanupTestCase when QT_NO_PRINTER is defined. Change-Id: I2527c018294b7518a4692f2c93da933848640b5d Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
* Test: remove QSKIP from printsupport testsCaroline Chao2012-09-121-24/+9
| | | | | | | | | Exclude printsupport tests from the build when QT_NO_PRINTER is defined. Change-Id: Iedae91666a599f4b77250abc8aac14c256fde34e Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* Stabilize qprinter testEskil Abrahamsen Blomfeldt2012-09-121-1/+10
| | | | | | | | | | | The CreationDate entry in the two PDF files can potentially be different depending on when the test is run. We ignore the line for this entry when comparing the two results. Task-number: QTBUG-27171 Change-Id: I8978678295217edd537edb0d2c25260813aa3d93 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Avoid duplicate setPen() in PDF when reusing QPrinterEskil Abrahamsen Blomfeldt2012-09-111-3/+0
| | | | | | | | | | | | The simplePen property was not reset when reusing the QPrinter, thus we would output two identical setPen() commands in the PDF making the autotest that compares the results fail. Task-number: QTBUG-27171 Change-Id: I601042ec59e45ef72a56f230f6112a91a259b4a5 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>