本文整理汇总了C++中Sheet::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Sheet::count方法的具体用法?C++ Sheet::count怎么用?C++ Sheet::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sheet
的用法示例。
在下文中一共展示了Sheet::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pageAt
/************************************************
*
* ***********************************************/
int PreviewWidget::pageAt(const QPoint &point) const
{
Sheet * sheet = project->currentSheet();
if (!sheet)
return -1;
for (int i=0; i<sheet->count(); ++i)
{
if (pageRect(i).contains(point))
return i;
}
return -1;
}
示例2: paintEvent
void PreviewWidget::paintEvent(QPaintEvent *event)
{
//#define DEBUG_LAYOUT
#ifdef DEBUG_LAYOUT
{
if (mImage.isNull())
return;
if (mSheetNum < 0)
return;
Sheet *sheet = project->previewSheet(mSheetNum);
if (!sheet)
return;
QPainter painter(this);
QRectF rect = project->printer()->paperRect();
painter.fillRect(rect, Qt::white);
for (int i=0; i< sheet->count(); ++i)
{
QPen pen = painter.pen();
pen.setStyle(Qt::DotLine);
pen.setColor(Qt::darkGray);
painter.setPen(pen);
TransformSpec spec = project->layout()->transformSpec(sheet, i, project->rotation());
painter.drawRect(spec.rect);
QFont font = painter.font();
font.setPixelSize(spec.rect.height() / 2 );
painter.setFont(font);
painter.drawText(spec.rect, Qt::AlignCenter, QString("%1").arg(i+1));
pen.setStyle(Qt::SolidLine);
pen.setColor(Qt::red);
painter.setPen(pen);
switch (spec.rotation)
{
case NoRotate:
painter.drawLine(spec.rect.topLeft(), spec.rect.topRight());
break;
case Rotate90:
painter.drawLine(spec.rect.topRight(), spec.rect.bottomRight());
break;
case Rotate180:
painter.drawLine(spec.rect.bottomLeft(), spec.rect.bottomRight());
break;
case Rotate270:
painter.drawLine(spec.rect.topLeft(), spec.rect.bottomLeft());
break;
}
}
return;
}
#endif
if (mImage.isNull())
return;
QSizeF printerSize = project->printer()->paperRect().size();
Rotation rotation = project->rotation();
if (isLandscape(rotation))
printerSize.transpose();
mScaleFactor = qMin((this->geometry().width() - 2.0 * MARGIN_H) * 1.0 / printerSize.width(),
(this->geometry().height() - 2.0 * MARGIN_V) * 1.0 / printerSize.height());
if (mScaleFactor == 0)
{
mDrawRect = QRect();
return;
}
QSize size = QSize(printerSize.width() * mScaleFactor,
printerSize.height() * mScaleFactor);
mDrawRect = QRect(QPoint(0, 0), size);
mDrawRect.moveCenter(QPoint(0, 0));
QRectF clipRect = mDrawRect;
if (mHints.testFlag(Sheet::HintOnlyLeft))
{
switch (rotation)
{
case NoRotate: clipRect.setBottom(0); break;
case Rotate90: clipRect.setRight(0); break;
case Rotate180: clipRect.setBottom(0); break;
case Rotate270: clipRect.setRight(0); break;
//.........这里部分代码省略.........