Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qprinter.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    269269  \brief The QPrinter class is a paint device that paints on a printer.
    270270
    271   \ingroup multimedia
    272   \mainclass
     271  \ingroup printing
     272
    273273
    274274  This device represents a series of pages of printed output, and is
     
    285285  the printProgram() function can be used to specify the command or utility
    286286  to use instead of the system default.
    287  
    288   Note that setting parameters like paper size and resolution on an 
     287
     288  Note that setting parameters like paper size and resolution on an
    289289  invalid printer is undefined. You can use QPrinter::isValid() to
    290290  verify this before changing any parameters.
     
    481481  \value A8 52 x 74 mm
    482482  \value A9 37 x 52 mm
    483   \value B0 1030 x 1456 mm
    484   \value B1 728 x 1030 mm
    485   \value B10 32 x 45 mm
    486   \value B2 515 x 728 mm
    487   \value B3 364 x 515 mm
    488   \value B4 257 x 364 mm
    489   \value B5 182 x 257 mm, 7.17 x 10.13 inches
    490   \value B6 128 x 182 mm
    491   \value B7 91 x 128 mm
    492   \value B8 64 x 91 mm
    493   \value B9 45 x 64 mm
     483  \value B0 1000 x 1414 mm
     484  \value B1 707 x 1000 mm
     485  \value B2 500 x 707 mm
     486  \value B3 353 x 500 mm
     487  \value B4 250 x 353 mm
     488  \value B5 176 x 250 mm, 6.93 x 9.84 inches
     489  \value B6 125 x 176 mm
     490  \value B7 88 x 125 mm
     491  \value B8 62 x 88 mm
     492  \value B9 33 x 62 mm
     493  \value B10 31 x 44 mm
    494494  \value C5E 163 x 229 mm
    495495  \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
    496496  \value DLE 110 x 220 mm
    497   \value Executive 7.5 x 10 inches, 191 x 254 mm
     497  \value Executive 7.5 x 10 inches, 190.5 x 254 mm
    498498  \value Folio 210 x 330 mm
    499   \value Ledger 432 x 279 mm
    500   \value Legal 8.5 x 14 inches, 216 x 356 mm
    501   \value Letter 8.5 x 11 inches, 216 x 279 mm
    502   \value Tabloid 279 x 432 mm
     499  \value Ledger 431.8 x 279.4 mm
     500  \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
     501  \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
     502  \value Tabloid 279.4 x 431.8 mm
    503503  \value Custom Unknown, or a user defined size.
    504504
     
    713713    delete d->previewEngine;
    714714#endif
    715     delete d;
    716715}
    717716
     
    745744#ifndef QT_NO_PDF
    746745    Q_D(QPrinter);
    747     if (d->outputFormat == format)
     746    if (d->validPrinter && d->outputFormat == format)
    748747        return;
    749748    d->outputFormat = format;
     
    774773        delete oldPrintEngine;
    775774
    776     d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
    777 
     775    if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat)
     776        d->validPrinter = true;
    778777#else
    779778    Q_UNUSED(format);
     
    794793
    795794
    796 /*! \reimp */
     795/*! \internal
     796*/
    797797int QPrinter::devType() const
    798798{
     
    835835
    836836    QList<QPrinterInfo> prnList = QPrinterInfo::availablePrinters();
    837     d->validPrinter = false;
    838     for (int i = 0; i < prnList.size(); ++i) {
    839         if (prnList[i].printerName() == name) {
    840             d->validPrinter = true;
    841             break;
     837    if (name.isEmpty()) {
     838        d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
     839    } else {
     840        d->validPrinter = false;
     841        for (int i = 0; i < prnList.size(); ++i) {
     842            if (prnList[i].printerName() == name) {
     843                d->validPrinter = true;
     844                break;
     845            }
    842846        }
    843847    }
     
    12721276  explicit call to the print code for each copy.
    12731277
    1274   \sa setNumCopies()
     1278  \sa setNumCopies(), actualNumCopies()
    12751279*/
    12761280
     
    12801284   return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();
    12811285}
     1286
     1287
     1288/*!
     1289    \since 4.6
     1290
     1291    Returns the number of copies that will be printed. The default
     1292    value is 1.
     1293
     1294    This function always returns the actual value specified in the print
     1295    dialog or using setNumCopies().
     1296
     1297    \sa setNumCopies(), numCopies()
     1298*/
     1299int QPrinter::actualNumCopies() const
     1300{
     1301    Q_D(const QPrinter);
     1302    return qt_printerRealNumCopies(d->paintEngine);
     1303}
     1304
    12821305
    12831306
     
    13051328    Returns true if collation is turned on when multiple copies is selected.
    13061329    Returns false if it is turned off when multiple copies is selected.
     1330    When collating is turned off the printing of each individual page will be repeated
     1331    the numCopies() amount before the next page is started. With collating turned on
     1332    all pages are printed before the next copy of those pages is started.
    13071333
    13081334    \sa setCollateCopies()
     
    16581684    const qreal multiplier = qt_multiplierForUnit(unit, resolution());
    16591685    QList<QVariant> margins(d->printEngine->property(QPrintEngine::PPK_PageMargins).toList());
    1660     *left = margins.at(0).toDouble() / multiplier;
    1661     *top = margins.at(1).toDouble() / multiplier;
    1662     *right = margins.at(2).toDouble() / multiplier;
    1663     *bottom = margins.at(3).toDouble() / multiplier;
     1686    *left = margins.at(0).toReal() / multiplier;
     1687    *top = margins.at(1).toReal() / multiplier;
     1688    *right = margins.at(2).toReal() / multiplier;
     1689    *bottom = margins.at(3).toReal() / multiplier;
    16641690}
    16651691
     
    21552181
    21562182/*!
    2157     Use QPrintDialog::addEnabledOption(QPrintDialog::PrintCollateCopies)
    2158     or QPrintDialog::setEnabledOptions(QPrintDialog::enabledOptions()
     2183    Use QPrintDialog::setOption(QPrintDialog::PrintCollateCopies)
     2184    or QPrintDialog::setOptions(QPrintDialog::options()
    21592185    & ~QPrintDialog::PrintCollateCopies) instead, depending on \a
    21602186    enable.
     
    21972223    \reentrant
    21982224
    2199     \ingroup multimedia
     2225    \ingroup printing
    22002226
    22012227    \brief The QPrintEngine class defines an interface for how QPrinter
Note: See TracChangeset for help on using the changeset viewer.