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


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

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


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

示例1: showFpsCounter

void MScenePrivate::showFpsCounter(QPainter *painter, float fps)
{
    Q_Q(MScene);

    QString display = QString("FPS: %1").arg((int)(fps + 0.5f));
    /* Draw a simple FPS counter in the lower right corner */
    static QRectF fpsRect(0, 0, FpsBoxSize.width(), FpsBoxSize.height());
    if (!q->views().isEmpty()) {
        MApplicationWindow *window = qobject_cast<MApplicationWindow *>(q->views().at(0));
        if (window) {
            if (manager && manager->orientation() == M::Portrait)
                fpsRect.moveTo(QPointF(window->visibleSceneSize().height() - FpsBoxSize.width(),
                                       window->visibleSceneSize().width() - FpsBoxSize.height()));
            else
                fpsRect.moveTo(QPointF(window->visibleSceneSize().width() - FpsBoxSize.width(),
                                       window->visibleSceneSize().height() - FpsBoxSize.height()));
        }
    }

    painter->fillRect(fpsRect, fpsBackgroundBrush);

    painter->setPen(FpsTextColor);
    painter->setFont(FpsFont);
    painter->drawText(fpsRect,
                      Qt::AlignCenter,
                      display);
}
开发者ID:dudochkin-victor,项目名称:libgogootouch,代码行数:27,代码来源:mscene.cpp

示例2: ResizeCommand

ResizeCommand *ResizeCommand::create(const NodeElement * const element
		, const QRectF &newContents, const QPointF &newPos
		, const QRectF &oldContents, const QPointF &oldPos)
{
	QRectF newContentsAndPos = newContents;
	newContentsAndPos.moveTo(newPos);
	QRectF oldContentsAndPos = oldContents;
	oldContentsAndPos.moveTo(oldPos);
	return new ResizeCommand(dynamic_cast<EditorViewScene *>(element->scene())
			, element->id(), oldContentsAndPos, newContentsAndPos);
}
开发者ID:Antropovi,项目名称:qreal,代码行数:11,代码来源:resizeCommand.cpp

示例3: textCursor

void
FormText::clearFormat()
{
	QTextCursor c = textCursor();

	if( c.hasSelection() )
	{
		QTextCharFormat fmt = c.charFormat();

		fmt.setFontUnderline( false );
		fmt.setFontItalic( false );
		fmt.setFontWeight( QFont::Normal );
		fmt.setFontPointSize( 10 );

		textCursor().setCharFormat( fmt );
	}
	else
	{
		QFont f = font();
		f.setUnderline( false );
		f.setItalic( false );
		f.setWeight( QFont::Normal );
		f.setPointSize( 10.0 );

		setFont( f );
	}

	QRectF r = boundingRect();
	r.moveTo( pos() );

	d->m_proxy->setRect( r );
}
开发者ID:igormironchik,项目名称:prototyper,代码行数:32,代码来源:form_text.cpp

示例4: updateProxyGeometryFromWidget

/*!
    \internal
*/
void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget()
{
    Q_Q(QGraphicsProxyWidget);
    if (!widget)
        return;

    QRectF widgetGeometry = widget->geometry();
    QWidget *parentWidget = widget->parentWidget();
    if (widget->isWindow()) {
        QGraphicsProxyWidget *proxyParent = 0;
        if (parentWidget && (proxyParent = qobject_cast<QGraphicsProxyWidget *>(q->parentWidget()))) {
            // Nested window proxy (e.g., combobox popup), map widget to the
            // parent widget's global coordinates, and map that to the parent
            // proxy's child coordinates.
            widgetGeometry.moveTo(proxyParent->subWidgetRect(parentWidget).topLeft()
                                  + parentWidget->mapFromGlobal(widget->pos()));
        }
    }

    // Adjust to size hint if the widget has never been resized.
    if (!widget->size().isValid())
        widgetGeometry.setSize(widget->sizeHint());

    // Assign new geometry.
    posChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode;
    sizeChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode;
    q->setGeometry(widgetGeometry);
    posChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
    sizeChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:33,代码来源:qgraphicsproxywidget.cpp

示例5: containsSceneSpace

bool ShaderNodeUI::containsSceneSpace(const QPointF& point) const
{
	QRectF localRect = boundingRect();
	localRect.moveTo(pos().x(), pos().y());

	return localRect.contains(point);
}
开发者ID:ppearson,项目名称:ImaginePartial,代码行数:7,代码来源:shader_node_view_items.cpp

示例6: addTeteToMinMax

  void ChatNode::addTeteToMinMax(Tete* tete,
                                 float* min_x, float* min_y,
                                 float* max_x, float* max_y) {
    //return;
    if(tete == NULL)
      return;
    if(tete->tete_node() == NULL)
      return;

    QRectF local_bound = tete->tete_node()->boundingRect();
    QRectF bound = local_bound;
    bound.moveTo(tete->tete_node()->pos());
    bound.translate(-local_bound.width()/2,-local_bound.height()/2);

    //std::cerr << bound.topLeft().y() << " " << *min_y << std::endl;

    if(bound.topLeft().x() < *min_x)
      *min_x = bound.topLeft().x();
    if(bound.topLeft().y() < *min_y)
      *min_y = bound.topLeft().y();
    if(bound.bottomRight().x() > *max_x)
      *max_x = bound.bottomRight().x();
    if(bound.bottomRight().y() > *max_y)
      *max_y = bound.bottomRight().y();
  }
开发者ID:ptierney,项目名称:Kaleidoscope,代码行数:25,代码来源:chatNode.cpp

示例7: updateAllTetesRect

  void ChatNode::updateAllTetesRect(){
    std::vector<Tete*> tetes = chat_->tetes();

    if(tetes.empty()){
      all_tetes_rect_ = QRectF(-1, -1, 2, 2);
      return;
    }

    TeteNode* first_node = NULL;
    // Find the first non-null node
    for(unsigned int i = 0u; first_node == NULL; i++){
      first_node = tetes[i]->tete_node();
    }

    QRectF local_bound = first_node->boundingRect();
    QRectF bound = local_bound;
    bound.moveTo(first_node->pos());
    // Translate more due to text
    bound.translate(-local_bound.width()/2,-local_bound.height()/2);

    float min_x = bound.topLeft().x();
    float min_y = bound.topLeft().y();
    float max_x = bound.bottomRight().x();
    float max_y = bound.bottomRight().y();

    for(std::vector<Tete*>::const_iterator it = tetes.begin(); it != tetes.end(); ++it){
      addTeteToMinMax(*it, &min_x, &min_y, &max_x, &max_y);
    }

    all_tetes_rect_ = QRectF(QPointF(min_x, min_y),
                             QPointF(max_x, max_y)).normalized();
  }
开发者ID:ptierney,项目名称:Kaleidoscope,代码行数:32,代码来源:chatNode.cpp

示例8: rectToScene

QRectF KWidget::rectToScene() const
{
    QRectF rt = rect();

    QPointF pt = mapToScene(rt.topLeft());
    rt.moveTo(pt);
    return rt;
}
开发者ID:kxtry,项目名称:kxmob,代码行数:8,代码来源:kwidget.cpp

示例9: paint

void AnchorIndicatorGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */)
{
    painter->save();

    QPen linePen(QColor(0, 0, 0, 150));
    linePen.setDashPattern(QVector<double>() << 3. << 2.);

    painter->setPen(linePen);

    painter->drawLine(m_startPoint, m_firstControlPoint);
    painter->drawLine(m_firstControlPoint, m_secondControlPoint);
    painter->drawLine(m_secondControlPoint, m_endPoint);

    linePen.setColor(QColor(255, 255, 255, 150));
    linePen.setDashPattern(QVector<double>() << 2. << 3.);
    linePen.setDashOffset(2.);

    painter->setPen(linePen);

    painter->drawLine(m_startPoint, m_firstControlPoint);
    painter->drawLine(m_firstControlPoint, m_secondControlPoint);
    painter->drawLine(m_secondControlPoint, m_endPoint);

    static QRectF bumpRectangle(0., 0., 8., 8.);

    painter->setPen(QPen(QColor(0, 255 , 0), 2));
    painter->drawLine(m_sourceAnchorLineFirstPoint, m_sourceAnchorLineSecondPoint);

    bumpRectangle.moveTo(m_startPoint.x() - 4., m_startPoint.y() - 4.);
    painter->setBrush(painter->pen().color());
    painter->setRenderHint(QPainter::Antialiasing, true);
    painter->drawChord(bumpRectangle, startAngleForAnchorLine(m_sourceAnchorLineType), 180 * 16);
    painter->setRenderHint(QPainter::Antialiasing, false);

    painter->setPen(QPen(QColor(0, 0 , 255), 2));
    painter->drawLine(m_targetAnchorLineFirstPoint, m_targetAnchorLineSecondPoint);

    bumpRectangle.moveTo(m_endPoint.x() - 4., m_endPoint.y() - 4.);
    painter->setBrush(painter->pen().color());
    painter->setRenderHint(QPainter::Antialiasing, true);
    painter->drawChord(bumpRectangle, startAngleForAnchorLine(m_targetAnchorLineType), 180 * 16);
    painter->setRenderHint(QPainter::Antialiasing, false);

    painter->restore();
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:45,代码来源:anchorindicatorgraphicsitem.cpp

示例10: rectToView

QRectF KWidget::rectToView() const
{
    QGraphicsView *gview = view();
    QRectF rt = rect();

    QPointF pt = mapToScene(rt.topLeft());
    QPoint vpt = gview->mapFromScene(pt);
    rt.moveTo(vpt);
    return rt;
}
开发者ID:kxtry,项目名称:kxmob,代码行数:10,代码来源:kwidget.cpp

示例11: tick

void Simulation::tick()
{
    qreal elapsed_secs = m_time.elapsed() * 1000.0;
    Q_FOREACH(QGraphicsItem* item, childItems()) {
        Particle* p = qobject_cast<Particle*>(item);
        if (p != 0) {
            p->move(elapsed_secs);
            QRectF bounds = p->boundingRect();
            bounds.moveTo(p->pos());
            qDebug() << "Scheduling update for" << bounds;
            update(bounds);
        }
    }
开发者ID:ilkka,项目名称:qml-playground,代码行数:13,代码来源:simulation.cpp

示例12: resize

void ResizeHandler::resize(QRectF newContents, QPointF newPos, bool needResizeParent) const
{
	newContents.moveTo(0, 0);

	sortChildrenIfNeeded();
	gripeIfMinimizesToChildrenContainer(newContents);

	if (!mTargetNode->isFolded()) {
		resizeAccordingToChildren(newContents, newPos);
	}
	normalizeSize(newContents);

	newContents.moveTo(newPos);

	mTargetNode->setGeometry(newContents);
	mTargetNode->storeGeometry();
	mTargetNode->setPos(newPos);

	if (needResizeParent) {
		resizeParent();
	}

	mTargetNode->updateLabels();
}
开发者ID:ASabina,项目名称:qreal,代码行数:24,代码来源:resizeHandler.cpp

示例13: QPointF

NodeElement *CopyHandler::clone(bool toCursorPos, bool searchForParents)
{
	EditorViewScene *evscene = dynamic_cast<EditorViewScene *>(mNode.scene());

	qReal::Id typeId = mNode.id().type();
	qReal::Id resultId = evscene->createElement(typeId.toString(), QPointF(), searchForParents);

	NodeElement *result = dynamic_cast<NodeElement *>(evscene->getElem(resultId));

	copyProperties(*result, mNode);
	copyChildren(*result, mNode);
	QRectF contents = mNode.contentsRect();
	if (toCursorPos) {
		contents.moveTo(evscene->getMousePos());
		result->setGeometry(contents);
		result->storeGeometry();
	}
	else {
		contents.moveTo(mNode.pos());
		result->setGeometry(contents);
	}

	return result;
}
开发者ID:Jurabek,项目名称:qreal,代码行数:24,代码来源:copyHandler.cpp

示例14: dizzy

void QgsStatusBarCoordinatesWidget::dizzy()
{
  if ( !mMapCanvas )
  {
    return;
  }
  // constants should go to options so that people can customize them to their taste
  int d = 10; // max. translational dizziness offset
  int r = 4;  // max. rotational dizzines angle
  QRectF rect = mMapCanvas->sceneRect();
  if ( rect.x() < -d || rect.x() > d || rect.y() < -d || rect.y() > d )
    return; // do not affect panning
  rect.moveTo(( qrand() % ( 2 * d ) ) - d, ( qrand() % ( 2 * d ) ) - d );
  mMapCanvas->setSceneRect( rect );
  QTransform matrix;
  matrix.rotate(( qrand() % ( 2 * r ) ) - r );
  mMapCanvas->setTransform( matrix );
}
开发者ID:RenShuYuan,项目名称:UAVplatform,代码行数:18,代码来源:qgsstatusbarcoordinateswidget.cpp

示例15: Paint

void CCJKShapeLine::Paint(QPainter * painter)
{
	CJK_D(CCJKShapeLine);
	BeginPaint(painter);
	painter->drawLine(d->line);
	if (!d->sText.isEmpty())
	{
		QPointF tmpPoint = d->line.pointAt(0.5);
		QFontMetrics fontMetrics(d->font);
		QRectF txtRect = fontMetrics.boundingRect(d->sText);
		txtRect.moveTo(tmpPoint);
		txtRect.translate(-txtRect.width() / 2, -txtRect.height() / 2);
		QPen tmpPen = d->pen;
		tmpPen.setColor(d->textColor);
		painter->setPen(tmpPen);
		painter->drawText(txtRect, d->sText);
	}
	DrawArrow(painter, d->line);
	EndPaint(painter);
}
开发者ID:kinglonglee,项目名称:cjk,代码行数:20,代码来源:cjkshapeline.cpp


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