当前位置: 首页>>代码示例>>C++>>正文


C++ Sheet::cellCoordinatesToDocument方法代码示例

本文整理汇总了C++中Sheet::cellCoordinatesToDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ Sheet::cellCoordinatesToDocument方法的具体用法?C++ Sheet::cellCoordinatesToDocument怎么用?C++ Sheet::cellCoordinatesToDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sheet的用法示例。


在下文中一共展示了Sheet::cellCoordinatesToDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shapeManager

QList<KoShape*> PrintJob::shapesOnPage(int pageNumber)
{
    // This method is called only for page preparation; to determine the shapes to wait for.
    int sheetPageNumber = pageNumber;
    Sheet* sheet = d->getSheetPageNumber(&sheetPageNumber);
    if (!sheet)
        return QList<KoShape*>();

    const QRect cellRange = d->printManager(sheet)->cellRange(sheetPageNumber);
    return shapeManager()->shapesAt(sheet->cellCoordinatesToDocument(cellRange));
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: printPage

void PrintJob::printPage(int pageNumber, QPainter &painter)
{
    kDebug(36004) << "Printing page" << pageNumber;
    int sheetPageNumber = pageNumber;
    Sheet* sheet = d->getSheetPageNumber(&sheetPageNumber);

    // Print the cells.
    if (sheet)
    {
        // Reset the offset made for shape printing.
        const double scale = POINT_TO_INCH(printer().resolution());
        const QRect cellRange = d->printManager(sheet)->cellRange(sheetPageNumber);
        const QRectF pageRect = sheet->cellCoordinatesToDocument(cellRange);
        painter.translate(pageRect.left() * scale, pageRect.top() * scale);

        // Scale according to the printer's resolution.
        painter.scale(scale, scale);

        d->printManager(sheet)->printPage(sheetPageNumber, painter);
    }
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例3: preparePage

QRectF PrintJob::preparePage(int pageNumber)
{
    int sheetPageNumber = pageNumber;
    Sheet* sheet = d->getSheetPageNumber(&sheetPageNumber);
    if (!sheet)
        return QRectF();

    // Move the painter offset according to the page layout.
    const double scale = POINT_TO_INCH(printer().resolution());
    const KoPageLayout pageLayout = sheet->printSettings()->pageLayout();
    painter().translate(pageLayout.left * scale, pageLayout.top * scale);

    // Apply the print zoom factor,
    const double zoom = d->printManager(sheet)->zoom();
    painter().scale(zoom, zoom);

    // Prepare the page for shape printing.
    const QRect cellRange = d->printManager(sheet)->cellRange(sheetPageNumber);
    QRectF pageRect = sheet->cellCoordinatesToDocument(cellRange);
    painter().translate(-pageRect.left() * scale, -pageRect.top() * scale);

    // Center the table on the page.
    if (sheet->printSettings()->centerHorizontally())
    {
        const double printWidth = sheet->printSettings()->printWidth(); // FIXME respect repeated columns
        const double offset = 0.5 * (printWidth / zoom - pageRect.width());
        painter().translate(offset * scale, 0.0);
        pageRect.moveLeft(offset); // scale will be applied below
    }
    if (sheet->printSettings()->centerVertically())
    {
        const double printHeight = sheet->printSettings()->printHeight(); // FIXME respect repeated rows
        const double offset = 0.5 * (printHeight / zoom - pageRect.height());
        painter().translate(0.0, offset * scale);
        pageRect.moveTop(offset); // scale will be applied below
    }
    return QRectF(pageRect.left() * scale, pageRect.top() * scale,
        pageRect.width() * scale, pageRect.height() * scale);
}
开发者ID:,项目名称:,代码行数:39,代码来源:


注:本文中的Sheet::cellCoordinatesToDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。