本文整理汇总了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));
}
示例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);
}
}
示例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);
}