Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r782 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    159159}
    160160
    161 
    162 // returns the actual num copies set on a printer, not
    163 // the number that is documented in QPrinter::numCopies()
    164 int qt_printerRealNumCopies(QPaintEngine *engine)
    165 {
    166     int numCopies = 1;
    167     if (engine->type() == QPaintEngine::PostScript
    168         || engine->type() == QPaintEngine::Pdf)
    169     {
    170         QPdfBaseEngine *base = static_cast<QPdfBaseEngine *>(engine);
    171         numCopies = base->d_func()->copies;
    172     }
    173 #ifdef Q_WS_WIN
    174     else if (engine->type() == QPaintEngine::Windows) {
    175         QWin32PrintEngine *base = static_cast<QWin32PrintEngine *>(engine);
    176         numCopies = base->d_func()->num_copies;
    177     }
    178 #endif
    179     return numCopies;
    180 }
    181 
    182161void QPrinterPrivate::createDefaultEngines()
    183162{
     
    304283  \i setFullPage() tells QPrinter whether you want to deal with the
    305284  full page or just with the part the printer can draw on.
    306   \i setNumCopies() tells QPrinter how many copies of the document
     285  \i setCopyCount() tells QPrinter how many copies of the document
    307286  it should print.
    308287  \endlist
     
    405384    \value Selection Only the selection should be printed.
    406385    \value PageRange The specified page range should be printed.
     386    \value CurrentPage Only the current page should be printed.
    407387
    408388    \sa QAbstractPrintDialog::PrintRange
     
    594574  \value Selection Only the selection should be printed.
    595575  \value PageRange Print according to the from page and to page options.
     576  \value CurrentPage Only the current page should be printed.
    596577
    597578  \sa setPrintRange(), printRange()
     
    609590  \value PrintPageRange Describes if printing page ranges (from, to) should
    610591  be enabled
     592  \value PrintCurrentPage if Print Current Page option should be enabled
    611593
    612594  \sa setOptionEnabled(), isOptionEnabled()
     
    756738
    757739    QPrintEngine *oldPrintEngine = d->printEngine;
    758     QPaintEngine *oldPaintEngine = d->paintEngine; // same as the above - shouldn't be deleted
    759740    const bool def_engine = d->use_default_engine;
    760741    d->printEngine = 0;
     
    769750            // will return 1, disregarding the actual value that was set
    770751            if (key == QPrintEngine::PPK_NumberOfCopies)
    771                 prop = QVariant(qt_printerRealNumCopies(oldPaintEngine));
     752                prop = QVariant(copyCount());
    772753            else
    773754                prop = oldPrintEngine->property(key);
     
    12771258
    12781259/*!
     1260  \obsolete
    12791261  Returns the number of copies to be printed. The default value is 1.
    12801262
     
    12891271  explicit call to the print code for each copy.
    12901272
     1273  Use copyCount() in conjunction with supportsMultipleCopies() instead.
     1274
    12911275  \sa setNumCopies(), actualNumCopies()
    12921276*/
     
    13001284
    13011285/*!
     1286    \obsolete
    13021287    \since 4.6
    13031288
     
    13081293    dialog or using setNumCopies().
    13091294
     1295    Use copyCount() instead.
     1296
    13101297    \sa setNumCopies(), numCopies()
    13111298*/
    13121299int QPrinter::actualNumCopies() const
    13131300{
    1314     Q_D(const QPrinter);
    1315     return qt_printerRealNumCopies(d->paintEngine);
    1316 }
    1317 
    1318 
    1319 
    1320 /*!
     1301    return copyCount();
     1302}
     1303
     1304
     1305
     1306/*!
     1307  \obsolete
    13211308  Sets the number of copies to be printed to \a numCopies.
    13221309
    13231310  The printer driver reads this setting and prints the specified
    13241311  number of copies.
     1312
     1313  Use setCopyCount() instead.
    13251314
    13261315  \sa numCopies()
     
    13351324}
    13361325
     1326/*!
     1327    \since 4.7
     1328
     1329    Sets the number of copies to be printed to \a count.
     1330
     1331    The printer driver reads this setting and prints the specified number of
     1332    copies.
     1333
     1334    \sa copyCount(), supportsMultipleCopies()
     1335*/
     1336
     1337void QPrinter::setCopyCount(int count)
     1338{
     1339    Q_D(QPrinter);
     1340    ABORT_IF_ACTIVE("QPrinter::setCopyCount;");
     1341    d->printEngine->setProperty(QPrintEngine::PPK_CopyCount, count);
     1342    d->addToManualSetList(QPrintEngine::PPK_CopyCount);
     1343}
     1344
     1345/*!
     1346    \since 4.7
     1347
     1348    Returns the number of copies that will be printed. The default value is 1.
     1349
     1350    \sa setCopyCount(), supportsMultipleCopies()
     1351*/
     1352
     1353int QPrinter::copyCount() const
     1354{
     1355    Q_D(const QPrinter);
     1356    return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();
     1357}
     1358
     1359/*!
     1360    \since 4.7
     1361
     1362    Returns true if the printer supports printing multiple copies of the same
     1363    document in one job; otherwise false is returned.
     1364
     1365    On most systems this function will return true. However, on X11 systems
     1366    that do not support CUPS, this function will return false. That means the
     1367    application has to handle the number of copies by printing the same
     1368    document the required number of times.
     1369
     1370    \sa setCopyCount(), copyCount()
     1371*/
     1372
     1373bool QPrinter::supportsMultipleCopies() const
     1374{
     1375    Q_D(const QPrinter);
     1376    return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();
     1377}
    13371378
    13381379/*!
     
    22762317    full page or not.
    22772318
    2278     \value PPK_NumberOfCopies An integer specifying the number of
    2279     copies
     2319    \value PPK_NumberOfCopies Obsolete. An integer specifying the number of
     2320    copies. Use PPK_CopyCount instead.
    22802321
    22812322    \value PPK_Orientation Specifies a QPrinter::Orientation value.
     
    23232364    \value PPK_PageMargins A QList<QVariant> containing the left, top,
    23242365    right and bottom margin values.
     2366
     2367    \value PPK_CopyCount An integer specifying the number of copies to print.
     2368
     2369    \value PPK_SupportsMultipleCopies A boolean value indicating whether or not
     2370    the printer supports printing multiple copies in one job.
    23252371
    23262372    \value PPK_CustomBase Basis for extension.
Note: See TracChangeset for help on using the changeset viewer.