本文整理汇总了C++中QPointF::strokeOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ QPointF::strokeOffset方法的具体用法?C++ QPointF::strokeOffset怎么用?C++ QPointF::strokeOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPointF
的用法示例。
在下文中一共展示了QPointF::strokeOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void PuzzleBoardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
// Save the original transform of the painter
QTransform originalTransform = painter->transform();
// Order the puzzle pieces by z value (ascending)
QList<PuzzlePiece*> puzzleItems = _game->puzzleItems().toList();
qSort(puzzleItems.begin(), puzzleItems.end(), PuzzlePiece::puzzleItemAscLessThan);
// Draw the pieces
foreach (PuzzlePiece *piece, puzzleItems)
{
QPointF p = piece->mapToParent(QPointF(0, 0));
QTransform transform = QTransform::fromTranslate(p.x(), p.y()).rotate(piece->rotation());
painter->setTransform(transform);
// Draw the strokes first
foreach (PuzzlePiecePrimitive *p, piece->primitives())
painter->drawPixmap(p->strokeOffset(), p->stroke());
// Draw the actual pixmaps
foreach (PuzzlePiecePrimitive *p, piece->primitives())
painter->drawPixmap(p->pixmapOffset(), p->pixmap());
}