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


C++ QRectF::moveTopRight方法代码示例

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


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

示例1: paint

void OnMonitorRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
    Q_UNUSED(widget)
    Q_UNUSED(option)

    painter->setPen(pen());
    //painter->setClipRect(option->rect);
    const QRectF r = rect();
    painter->drawRect(r);
    QRectF handle = painter->worldTransform().inverted().mapRect(QRectF(0, 0, 6, 6));
    if (isEnabled()) {
        handle.moveTopLeft(r.topLeft());
        painter->fillRect(handle, QColor(Qt::yellow));
        handle.moveTopRight(r.topRight());
        painter->fillRect(handle, QColor(Qt::yellow));
        handle.moveBottomLeft(r.bottomLeft());
        painter->fillRect(handle, QColor(Qt::yellow));
        handle.moveBottomRight(r.bottomRight());
        painter->fillRect(handle, QColor(Qt::yellow));
    }
    
    // Draw cross at center
    QPointF center = r.center();
    painter->drawLine(center + QPointF(-handle.width(), 0), center + QPointF(handle.width(), 0));
    painter->drawLine(center + QPointF(0, handle.height()), center + QPointF(0, -handle.height()));
}
开发者ID:JongHong,项目名称:kdenlive,代码行数:26,代码来源:onmonitorrectitem.cpp

示例2: addImage

void QQuickTextNodeEngine::addImage(const QRectF &rect, const QImage &image, qreal ascent,
                                    SelectionState selectionState,
                                    QTextFrameFormat::Position layoutPosition)
{
    QRectF searchRect = rect;
    if (layoutPosition == QTextFrameFormat::InFlow) {
        if (m_currentLineTree.isEmpty()) {
            searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1));
        } else {
            const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1;
            if (lastNode->glyphRun.isRightToLeft()) {
                QPointF lastPos = lastNode->boundingRect.topLeft();
                searchRect.moveTopRight(lastPos - QPointF(0, ascent - lastNode->ascent));
            } else {
                QPointF lastPos = lastNode->boundingRect.topRight();
                searchRect.moveTopLeft(lastPos - QPointF(0, ascent - lastNode->ascent));
            }
        }
    }

    BinaryTreeNode::insert(&m_currentLineTree, searchRect, image, ascent, selectionState);
    m_hasContents = true;
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:23,代码来源:qquicktextnodeengine.cpp

示例3: update

void TransformableGraphicsGuide::update()
{
	if (isVisible())
	{
		FigureEditor::EditMode mode = editor->mode();

		bool scaleMode( mode == FigureEditor::Scale );
		topRightRect.setVisible(scaleMode);
		topLeftRect.setVisible(scaleMode);
		bottomRightRect.setVisible(scaleMode);
		bottomLeftRect.setVisible(scaleMode);

		if (scaleMode)
		{
			QPointF cen;
			QPolygonF poly;

			if (editor->hasSelection())
			{
				QGraphicsPolygonItem* item = editor->selection();
				if (item == 0)
					return;
				cen  = mapFromScene(editor->selectionTransformPos());
				poly = mapFromScene(item->polygon());
			}
			else
			{
				QGraphicsPolygonItem* item = dynamic_cast<QGraphicsPolygonItem*>(parentItem());
				cen  = editor->triangleTransformPos();
				poly = item->polygon();
			}
			QRectF f( poly.boundingRect() );
			qreal xmax = qMax(qAbs(f.left() - cen.x()), qAbs(f.right()  - cen.x()));
			qreal ymax = qMax(qAbs(f.top()  - cen.y()), qAbs(f.bottom() - cen.y()));
			QPointF pmax(xmax, ymax);
			QRectF r(pmax, -pmax);

			r.moveCenter(cen);
			outerRect = r;
			QRectF l = parentItem()->mapRectFromScene(QRectF(QPointF(0.0, 0.0), QSizeF(10, 10)));
			QPen pen( editor->guideColor() );

			l.moveBottomLeft(r.topRight());
			topRightRect.setPen(pen);
			topRightRect.setRect(l);

			l.moveBottomRight(r.topLeft());
			topLeftRect.setPen(pen);
			topLeftRect.setRect(l);

			l.moveTopLeft(r.bottomRight());
			bottomRightRect.setPen(pen);
			bottomRightRect.setRect(l);

			l.moveTopRight(r.bottomLeft());
			bottomLeftRect.setPen(pen);
			bottomLeftRect.setRect(l);
		}
		else if (mode == FigureEditor::Rotate)
		{
			QGraphicsPolygonItem* item;
			QPointF cen;
			QPolygonF poly;
			if (editor->hasSelection())
			{
				item = editor->selection();
				if (item == 0)
					return;
				cen  = mapFromScene(editor->selectionTransformPos());
				poly = mapFromScene(item->polygon());
			}
			else
			{
				item = dynamic_cast<QGraphicsPolygonItem*>(parentItem());
				poly = item->polygon();
				cen = editor->triangleTransformPos();
			}
			qreal rmax = 0.0;
			foreach (QPointF p, poly)
			{
				QLineF l(p, cen);
				qreal len(l.length());
				if (len > rmax)
					rmax = len;
			}
			qreal height = rmax * 2.0;
			outerRect = QRectF(cen.x() - rmax, cen.y() - rmax, height, height);
		}
开发者ID:AlfredoCubitos,项目名称:qosmic,代码行数:88,代码来源:transformablegraphicsguide.cpp


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