⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qprinter.cpp

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
}/*!  Returns the document name.  \sa setDocName()*/QString QPrinter::docName() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();}/*!  Sets the document name to \a name.*/void QPrinter::setDocName(const QString &name){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setDocName()");    d->printEngine->setProperty(QPrintEngine::PPK_DocumentName, name);}/*!  Returns the name of the application that created the document.  \sa setCreator()*/QString QPrinter::creator() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_Creator).toString();}/*!  Sets the name of the application that created the document to \a  creator.  This function is only applicable to the X11 version of Qt. If no  creator name is specified, the creator will be set to "Qt"  followed by some version number.  \sa creator()*/void QPrinter::setCreator(const QString &creator){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setCreator");    d->printEngine->setProperty(QPrintEngine::PPK_Creator, creator);}/*!  Returns the orientation setting. This is driver-dependent, but is usually  QPrinter::Portrait.  \sa setOrientation()*/QPrinter::Orientation QPrinter::orientation() const{    Q_D(const QPrinter);    return QPrinter::Orientation(d->printEngine->property(QPrintEngine::PPK_Orientation).toInt());}/*!  Sets the print orientation to \a orientation.  The orientation can be either QPrinter::Portrait or  QPrinter::Landscape.  The printer driver reads this setting and prints using the  specified orientation.  On Windows and Mac OS X, this option can be changed while printing and will  take effect from the next call to newPage().  \sa orientation()*/void QPrinter::setOrientation(Orientation orientation){    Q_D(QPrinter);    d->printEngine->setProperty(QPrintEngine::PPK_Orientation, orientation);}/*!  Returns the printer page size. The default value is driver-dependent.  \sa setPageSize() pageRect() paperRect()*/QPrinter::PageSize QPrinter::pageSize() const{    Q_D(const QPrinter);    return QPrinter::PageSize(d->printEngine->property(QPrintEngine::PPK_PageSize).toInt());}/*!  Sets the printer page size to \a newPageSize if that size is  supported. The result if undefined if \a newPageSize is not  supported.  The default page size is driver-dependent.  This function is useful mostly for setting a default value that  the user can override in the print dialog.  \sa pageSize() PageSize setFullPage() setResolution() pageRect() paperRect()*/void QPrinter::setPageSize(PageSize newPageSize){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setPageSize()");    if (newPageSize > NPageSize) {        qWarning("QPrinter::SetPageSize: illegal page size %d", newPageSize);        return;    }    d->printEngine->setProperty(QPrintEngine::PPK_PageSize, newPageSize);}/*!    Sets the page order to \a pageOrder.    The page order can be QPrinter::FirstPageFirst or    QPrinter::LastPageFirst. The application is responsible for    reading the page order and printing accordingly.    This function is mostly useful for setting a default value that    the user can override in the print dialog.*/void QPrinter::setPageOrder(PageOrder pageOrder){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setPageOrder()");    d->printEngine->setProperty(QPrintEngine::PPK_PageOrder, pageOrder);}/*!  Returns the current page order.  The default page order is \c FirstPageFirst.*/QPrinter::PageOrder QPrinter::pageOrder() const{    Q_D(const QPrinter);    return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());}/*!  Sets the printer's color mode to \a newColorMode, which can be  either \c Color or \c GrayScale.  \sa colorMode()*/void QPrinter::setColorMode(ColorMode newColorMode){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setColorMode()");    d->printEngine->setProperty(QPrintEngine::PPK_ColorMode, newColorMode);}/*!  Returns the current color mode.  \sa setColorMode()*/QPrinter::ColorMode QPrinter::colorMode() const{    Q_D(const QPrinter);    return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());}/*!  Returns the number of copies to be printed. The default value is 1.  On Windows and Mac OS X, this will always return 1 as these operating systems  can internally handle the number of copies.  On X11, this value will return the number of times the application is  required to print in order to match the number specified in the printer setup  dialog. This has been done since some printer drivers are not capable of  buffering up the copies and in those cases the application must make an  explicit call to the print code for each copy.  \sa setNumCopies()*/int QPrinter::numCopies() const{    Q_D(const QPrinter);   return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();}/*!  Sets the number of copies to be printed to \a numCopies.  The printer driver reads this setting and prints the specified  number of copies.  \sa numCopies()*/void QPrinter::setNumCopies(int numCopies){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setNumCopies()");    d->printEngine->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies);}/*!    \since 4.1    Returns true if collation is turned on when multiple copies is selected.    Returns false if it is turned off when multiple copies is selected.    \sa setCollateCopies()*/bool QPrinter::collateCopies() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();}/*!    \since 4.1    Sets the default value for collation checkbox when the print    dialog appears.  If \a collate is true, it will enable    setCollateCopiesEnabled().  The default value is false. This value    will be changed by what the user presses in the print dialog.    \sa collateCopies()*/void QPrinter::setCollateCopies(bool collate){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setCollateCopies()");    d->printEngine->setProperty(QPrintEngine::PPK_CollateCopies, collate);}/*!  Sets QPrinter to have the origin of the coordinate system at the  top-left corner of the paper if \a fp is true, or where it thinks  the top-left corner of the printable area is if \a fp is false.  The default is false. You can (probably) print on (0,0), and  the device metrics will report something smaller than the size  indicated by PageSize. (Note that QPrinter may be wrong on Unix  systems: it does not have perfect knowledge of the physical  printer.)  If \a fp is true, the device metrics will report the exact same  size as indicated by \c PageSize. It probably isn't possible to  print on the entire page because of the printer's physical  margins, so the application must account for the margins itself.  \sa PageSize setPageSize() fullPage() width() height()*/void QPrinter::setFullPage(bool fp){    Q_D(QPrinter);    d->printEngine->setProperty(QPrintEngine::PPK_FullPage, fp);}/*!  Returns true if the origin of the printer's coordinate system is  at the corner of the page and false if it is at the edge of the  printable area.  See setFullPage() for details and caveats.  \sa setFullPage() PageSize*/bool QPrinter::fullPage() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();}/*!  Requests that the printer prints at \a dpi or as near to \a dpi as  possible.  This setting affects the coordinate system as returned by, for  example QPainter::viewport().  This function must be called before QPainter::begin() to have an effect on  all platforms.  \sa resolution() setPageSize()*/void QPrinter::setResolution(int dpi){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setResolution()");    d->printEngine->setProperty(QPrintEngine::PPK_Resolution, dpi);}/*!  Returns the current assumed resolution of the printer, as set by  setResolution() or by the printer driver.  \sa setResolution()*/int QPrinter::resolution() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();}/*!  Sets the paper source setting to \a source.  Windows only: This option can be changed while printing and will  take effect from the next call to newPage()  \sa paperSource()*/void QPrinter::setPaperSource(PaperSource source){    Q_D(QPrinter);    d->printEngine->setProperty(QPrintEngine::PPK_PaperSource, source);}/*!    Returns the printer's paper source. This is \c Manual or a printer    tray or paper cassette.*/QPrinter::PaperSource QPrinter::paperSource() const{    Q_D(const QPrinter);    return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());}/*!  \since 4.1  Enabled or disables font embedding depending on \a enable.  Currently this option is only supported on X11.  \sa fontEmbeddingEnabled()*/void QPrinter::setFontEmbeddingEnabled(bool enable){    Q_D(QPrinter);    d->printEngine->setProperty(QPrintEngine::PPK_FontEmbedding, enable);}/*!  \since 4.1  Returns true is font embedding is enabled.  Currently this option is only supported on X11.  \sa setFontEmbeddingEnabled()*/bool QPrinter::fontEmbeddingEnabled() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();}/*!    Returns the page's rectangle; this is usually smaller than the    paperRect() since the page normally has margins between its    borders and the paper.    \sa pageSize()*/QRect QPrinter::pageRect() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_PageRect).toRect();}/*!    Returns the paper's rectangle; this is usually larger than the    pageRect().   \sa pageRect()*/QRect QPrinter::paperRect() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect();}/*!    \internal    Returns the metric for the given \a id.*/int QPrinter::metric(PaintDeviceMetric id) const{    Q_D(const QPrinter);    return d->printEngine->metric(id);}/*!    Returns the paint engine used by the printer.*/QPaintEngine *QPrinter::paintEngine() const{    Q_D(const QPrinter);    return d->paintEngine;}/*!    \since 4.1    Returns the print engine used by the printer.*/QPrintEngine *QPrinter::printEngine() const{    Q_D(const QPrinter);    return d->printEngine;}#if defined (Q_WS_WIN)/*!    Sets the page size to be used by the printer under Windows to \a    pageSize.    \warning This function is not portable so you may prefer to use    setPageSize() instead.    \sa winPageSize()*/void QPrinter::setWinPageSize(int pageSize){    Q_D(QPrinter);    ABORT_IF_ACTIVE("QPrinter::setWinPageSize()");    d->printEngine->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize);}/*!    Returns the page size used by the printer under Windows.    \warning This function is not portable so you may prefer to use    pageSize() instead.    \sa setWinPageSize()*/int QPrinter::winPageSize() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt();}#endif // Q_WS_WIN/*!    Returns a list of the resolutions (a list of dots-per-inch    integers) that the printer says it supports.    For X11 where all printing is directly to postscript, this    function will always return a one item list containing only the    postscript resolution, i.e., 72 (72 dpi -- but see PrinterMode).*/QList<int> QPrinter::supportedResolutions() const{    Q_D(const QPrinter);    QList<QVariant> varlist        = d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList();    QList<int> intlist;    for (int i=0; i<varlist.size(); ++i)        intlist << varlist.at(i).toInt();    return intlist;}/*!    Tells the printer to eject the current page and to continue    printing on a new page. Returns true if this was successful;    otherwise returns false.*/bool QPrinter::newPage(){    Q_D(QPrinter);    return d->printEngine->newPage();}/*!    Aborts the current print run. Returns true if the print run was    successfully aborted and printerState() will return QPrinter::Aborted; otherwise    returns false.    It is not always possible to abort a print job. For example,    all the data has gone to the printer but the printer cannot or    will not cancel the job when asked to.*/bool QPrinter::abort(){    Q_D(QPrinter);    return d->printEngine->abort();}#if 0/*!  \fn int QPrinter::minPage() const  Returns the min-page setting, i.e. the lowest page number a user  is allowed to choose. The default value is 0 which signifies 'any  page'.  \sa maxPage(), setMinMax() setFromTo()*//*!  \fn int QPrinter::maxPage() const  Returns the max-page setting. A user can't choose a higher page  number than maxPage() when they select a print range. The default  value is 0 which signifies the last page (up to a maximum of  9999).  \sa minPage(), setMinMax() setFromTo()*//*!  Sets the min-page and max-page settings to \a minPage and \a  maxPage respectively.  The min-page and max-page restrict the from-page and to-page  settings. When the printer setup dialog appears, the user cannot  select a from page or a to page that are outside the range  specified by min and max pages.  \sa minPage(), maxPage(), setFromTo(), setup()*/void QPrinter::setMinMax(int minPage, int maxPage){    min_pg = minPage;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -