Пример #1
0
QSizeF PosteRazorCore::printablePaperAreaSize() const
{
    return QSizeF(
        paperSize().width() - paperBorderLeft() - paperBorderRight(),
        paperSize().height() - paperBorderTop() - paperBorderBottom()
    );
}
Пример #2
0
qreal KDReports::ReportPrivate::mainTextDocHeight() const
{
    const qreal height = rawMainTextDocHeight();
    const bool skip = height <= 0;
    if ( skip ) {
        qreal textDocHeight = paperSize().height() - mmToPixels( m_marginTop + m_marginBottom );
        textDocHeight -= mmToPixels( m_headerBodySpacing );
        textDocHeight -= mmToPixels( m_footerBodySpacing );
        return textDocHeight;
    }
    return height;
}
Пример #3
0
// The height of the text doc, by calculation. Adjusted by caller, if negative.
qreal KDReports::ReportPrivate::rawMainTextDocHeight() const
{
    qreal textDocHeight = paperSize().height() - mmToPixels( m_marginTop + m_marginBottom );
    const qreal headerHeight = m_headers.height();
    textDocHeight -= headerHeight;
    textDocHeight -= mmToPixels( m_headerBodySpacing );
    const qreal footerHeight = m_footers.height();
    textDocHeight -= mmToPixels( m_footerBodySpacing );
    textDocHeight -= footerHeight;
    //qDebug() << "pageContent height (pixels): paper size" << m_paperSize.height() << "minus margins" << mmToPixels( m_marginTop + m_marginBottom )
    //        << "minus headerHeight" << headerHeight << "minus footerHeight" << footerHeight << "and spacings =" << textDocHeight;
    return textDocHeight;
}
Пример #4
0
void MainWindow::preparePrinter(QPrinter *printer)
{
    QSettings settings("Settings.ini", QSettings::IniFormat);
    settings.beginGroup("Settings");

    QSizeF paperSize(settings.value("sheet-width", 210.0).toInt(), settings.value("sheet-height", 297.0).toInt());
    bool isPortrait = settings.value("is-sheet-orientation-vertical", true).toBool();

    printer->setPaperSize(paperSize, QPrinter::Millimeter);
    printer->setResolution(settings.value("dpi", 300).toInt());
    printer->setOrientation(isPortrait ? QPrinter::Portrait : QPrinter::Landscape);

    settings.endGroup();
}
Пример #5
0
void KDReports::ReportPrivate::ensureLayouted()
{
    // We need to do a layout if
    // m_pageContentSizeDirty is true, i.e. page size has changed etc.
    if (m_pageContentSizeDirty) {
        if (!wantEndlessPrinting()) {
            setPaperSizeFromPrinter(paperSize());
        } else {
            // Get the document to fit into one page
            Q_ASSERT(m_layoutWidth != 0);
            qreal textDocWidth = m_layoutWidth - mmToPixels(m_marginLeft + m_marginRight);
            m_paperSize = layoutAsOnePage(textDocWidth);

            qDebug() << "setPaperSizeFromPrinter: endless printer. m_layoutWidth=" << m_layoutWidth
              << "textDocWidth=" << textDocWidth
              << "single page has size" << m_paperSize << "pixels";

            Q_ASSERT(m_layout->numberOfPages() == 1);
        }
        // at this point m_pageContentSizeDirty has been set to false in all cases
    }

    m_layout->ensureLayouted();
}
Пример #6
0
qreal KDReports::ReportPrivate::textDocumentWidth() const
{
    return paperSize().width() - mmToPixels( m_marginLeft + m_marginRight );
}
Пример #7
0
QString PageFormat::name() const
      {
      return paperSize()->name;
      }
Пример #8
0
qreal PosteRazorCore::maximalOverLappingHeight() const
{
    return paperSize().height() - paperBorderTop() - paperBorderBottom() - convertCmToDistance(1.0);
}
Пример #9
0
qreal PosteRazorCore::maximalOverLappingWidth() const
{
    return paperSize().width() - paperBorderLeft() - paperBorderRight() - convertCmToDistance(1.0);
}
Пример #10
0
qreal PosteRazorCore::maximalHorizontalPaperBorder() const
{
    return paperSize().height() / 2.0 - convertCmToDistance(1.0);
}
Пример #11
0
qreal PosteRazorCore::maximalVerticalPaperBorder() const
{
    return paperSize().width() / 2.0 - convertCmToDistance(1.0);
}
Пример #12
0
void KDReports::ReportPrivate::setupPrinter( QPrinter* printer )
{
    printer->setFullPage( true );
    printer->setOrientation( m_orientation );
    printer->setPaperSize( paperSize(), QPrinter::DevicePixel );
}