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

📄 qprinter.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 4 页
字号:
  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);}/*!  If \a fp is true, enables support for painting over the entire page;  otherwise restricts painting to the printable area reported by the  device.  By default, full page printing is disabled. In this case, the origin  of the QPrinter's coordinate system coincides with the top-left  corner of the printable area.  If full page printing is enabled, the origin of the QPrinter's  coordinate system coincides with the top-left corner of the paper  itself. In this case, the  \l{QPaintDevice::PaintDeviceMetric}{device metrics} will report  the exact same dimensions as indicated by \l{PageSize}. It may not  be possible to print on the entire physical page because of the  printer's margins, so the application must account for the margins  itself.  \sa fullPage(), setPageSize(), width(), height(), {Printing with Qt}*/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 if 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();}/*!  \since 4.2  Enables double sided printing if \a doubleSided is true; otherwise disables it.  Currently this option is only supported on X11.*/void QPrinter::setDoubleSidedPrinting(bool doubleSided){    Q_D(QPrinter);    d->printEngine->setProperty(QPrintEngine::PPK_Duplex, doubleSided);}/*!  \since 4.2  Returns true if double side printing is enabled.  Currently this option is only supported on X11.*/bool QPrinter::doubleSidedPrinting() const{    Q_D(const QPrinter);    return d->printEngine->property(QPrintEngine::PPK_Duplex).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();}/*!    Returns the current state of the printer. This may not always be    accurate (for example if the printer doesn't have the capability    of reporting its state to the operating system).*/QPrinter::PrinterState QPrinter::printerState() const{    Q_D(const QPrinter);    return d->printEngine->printerState();}/*! \fn void QPrinter::margins(uint *top, uint *left, uint *bottom, uint *right) const    Sets *\a top, *\a left, *\a bottom, *\a right to be the top,    left, bottom, and right margins.    This function has been superseded by paperRect() and pageRect().    Use paperRect().top() - pageRect().top() for the top margin,    paperRect().left() - pageRect().left() for the left margin,    paperRect().bottom() - pageRect().bottom() for the bottom margin,    and papaerRect().right() - pageRect().right() for the right    margin.    \oldcode        uint rightMargin;        uint bottomMargin;        printer->margins(0, 0, &bottomMargin, &rightMargin);    \newcode        int rightMargin = printer->paperRect().right() - printer->pageRect().right();        int bottomMargin = printer->paperRect().bottom() - printer->pageRect().bottom();    \endcode*//*! \fn QSize QPrinter::margins() const    \overload    Returns a QSize containing the left margin and the top margin.    This function has been superseded by paperRect() and pageRect().    Use paperRect().left() - pageRect().left() for the left margin,    and paperRect().top() - pageRect().top() for the top margin.    \oldcode        QSize margins = printer->margins();        int leftMargin = margins.width();        int topMargin = margins.height();    \newcode        int leftMargin = printer->paperRect().left() - printer->pageRect().left();        int topMargin = printer->paperRect().top() - printer->pageRect().top();    \endcode*//*! \fn bool QPrinter::aborted()    Use printerState() == QPrinter::Aborted instead.*/#ifdef Q_WS_WIN/*!    \internal*/HDC QPrinter::getDC() const{    Q_D(const QPrinter);    return d->printEngine->getPrinterDC();}/*!    \internal*/void QPrinter::releaseDC(HDC hdc) const{    Q_D(const QPrinter);    d->printEngine->releasePrinterDC(hdc);}/*!    Returns the supported paper sizes for this printer.    The values will be either a value that matches an entry in the    QPrinter::PaperSource enum or a driver spesific value. The driver    spesific values are greater than the constant DMBIN_USER declared    in wingdi.h.    \warning This function is only available in windows.*/QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const{    Q_D(const QPrinter);    QVariant v = d->printEngine->property(QPrintEngine::PPK_PaperSources);    QList<QVariant> variant_list = v.toList();    QList<QPrinter::PaperSource> int_list;    for (int i=0; i<variant_list.size(); ++i)        int_list << (QPrinter::PaperSource) variant_list.at(i).toInt();    return int_list;}

⌨️ 快捷键说明

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