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


C++ scenePos函数代码示例

本文整理汇总了C++中scenePos函数的典型用法代码示例。如果您正苦于以下问题:C++ scenePos函数的具体用法?C++ scenePos怎么用?C++ scenePos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: calcNecessaryBoundingRect

QRectF Item::sceneBoundingRectCoord(QPoint const &topLeftPicture)
{
	QRectF itemBoundingRect = calcNecessaryBoundingRect();
	qreal const x1 = scenePos().x() + itemBoundingRect.x() - topLeftPicture.x();
	qreal const y1 = scenePos().y() + itemBoundingRect.y() - topLeftPicture.y();
	return QRectF(x1, y1, itemBoundingRect.width(), itemBoundingRect.height());
}
开发者ID:nfrey,项目名称:qreal,代码行数:7,代码来源:item.cpp

示例2: QString

void PictoProcedure::toXml( QDomDocument& doc, QDomNode& node ) const
{/*{{{*/
     QDomElement item = doc.createElement( "Procedure" );
     node.appendChild( item );
     QDomElement position = doc.createElement( "Position" );
     position.appendChild( doc.createTextNode( QString( "%1;%2" ).arg( scenePos().x() )
                           .arg( scenePos().y() ) ) );
     item.appendChild( position );
     QDomElement style = doc.createElement( "StyleLien" );
     style.appendChild( doc.createTextNode(
                             ( liaison_ ) ?
                             QString::number( static_cast<int>( liaison_->style() ) ) :
                             "1" ) ) ;
     item.appendChild( style );
     QDomElement preAssertion = doc.createElement( "PreAssertion" );
     preAssertion.appendChild( doc.createTextNode( labels_.at( 0 )->label() ) );
     item.appendChild( preAssertion );
     QDomElement postAssertion = doc.createElement( "PostAssertion" );
     postAssertion.appendChild( doc.createTextNode( labels_.at( 2 )->label() ) );
     item.appendChild( postAssertion );
     QDomElement titre = doc.createElement( "Titre" );
     titre.appendChild( doc.createTextNode( labels_.at( 1 )->label() ) );
     item.appendChild( titre );
     QDomElement details = doc.createElement( "DetailsVisible" );
     details.appendChild( doc.createTextNode( detail_ ? "1" : "0" ) );
     item.appendChild( details );
     QDomElement detailsVide = doc.createElement( "DetailsVideVisible" );
     detailsVide.appendChild( doc.createTextNode( emptyDetail_ ? "1" : "0" ) );
     item.appendChild( detailsVide );
     QDomElement enfants = doc.createElement( "Enfants" );
     item.appendChild( enfants );
     AncreItem* picto;
     foreach( picto, children_ )
     static_cast<Pictogramme*>( picto )->toXml( doc, enfants );
}/*}}}*/
开发者ID:erebe,项目名称:Tabula_rasa,代码行数:35,代码来源:pictoProcedure.cpp

示例3: LOG_DEBUG

void TraceGraphPoint::updatePositionOnScene(const Trace::TracePointer& i_trace) {
  LOG_DEBUG("Updating the position on the scene of this Point");
  switch (m_positionOnTrace) {
  case TraceGraphPoint::StartPoint : {
    setPos(QPoint(0,0));
    // No need to change the position, 0,0 is ALWAYS the start point
    break;
  }
  case TraceGraphPoint::EndPoint : {
    if (i_trace->getEndPoint() != scenePos()) {
      LOG_DEBUG("Update end point on scene");
      setPos(Point2D(i_trace->getEndPoint() - i_trace->getStartPoint()));
    }
    break;
  }
  case TraceGraphPoint::CenterPoint : {
    if (RotationTrace::RotationTracePointer rotationTrace =
        std::dynamic_pointer_cast<RotationTrace>(i_trace)) {
      if (rotationTrace->getCentrePoint() != scenePos())
      LOG_DEBUG("Update Center point on scene");
      setPos(Point2D(rotationTrace->getCentrePoint() - i_trace->getStartPoint()));
    } else {
      LOG_ERROR("Could not convert the trace to a rotation" <<
    " trace while the point was a center point!");
    }
    break;
  }
  default : {
    LOG_ERROR("unknown PointPosition");
    break;
  }}
}
开发者ID:Kaldie,项目名称:GeRoBot,代码行数:32,代码来源:TraceGraphPoint.cpp

示例4: setX

void CommonItemMECS::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    QGraphicsItem::mouseReleaseEvent(event);

    setX(snapToGrid(scenePos().x()));
    setY(snapToGrid(scenePos().y()));
    update();
}
开发者ID:lutc,项目名称:Interfacer,代码行数:8,代码来源:commonitemmecs.cpp

示例5: scenePos

Avoid::Point Handle::getPointPosition(void)
{
    Avoid::Point retVal;

    retVal.x = scenePos().x();
    retVal.y = scenePos().y();

    return retVal;
}
开发者ID:SiteView,项目名称:NNMQT,代码行数:9,代码来源:handle.cpp

示例6: changeDragState

void Curve::changeDragState(qreal x, qreal y)
{
	Item::changeDragState(x, y);
	if (QRectF(QPointF(mC1.x() + scenePos().x(), mC1.y() + scenePos().y())
			, QSizeF(0, 0)).adjusted(-resizeDrift, -resizeDrift, resizeDrift, resizeDrift).contains(QPointF(x, y)))
	{
		mDragState = Ctrl;
	}
}
开发者ID:ASabina,项目名称:qreal,代码行数:9,代码来源:curve.cpp

示例7: boundingRect

QPointF CopyFilterGUIChannelItem::getPerimeterPointTo(QPointF oppositePoint)
{
    QRectF rect = boundingRect();

    if (output)
        return scenePos() + QPointF(rect.center().x(), rect.top());
    else
        return scenePos() + QPointF(rect.center().x(), rect.top() + rect.height());
}
开发者ID:calupator,项目名称:equalizerapo,代码行数:9,代码来源:CopyFilterGUIChannelItem.cpp

示例8: scg_cfg_get_value_color

QVariant SCgObject::itemChange(GraphicsItemChange change, const QVariant &value)
{
    // item selection changed
    if (change == QGraphicsItem::ItemSelectedHasChanged)
    {
        if (isSelected())
        {
            mColor = scg_cfg_get_value_color(scg_key_element_color_selected);//QColor(255, 128, 64);
            //setCursor(QCursor(Qt::SizeAllCursor));
        }
        else
        {
            mColor = scg_cfg_get_value_color(scg_key_element_color_normal);//QColor(0, 0, 0);
            //setCursor(QCursor(Qt::ArrowCursor));
        }
    }

    // move to correct position automaticly
    if (change == QGraphicsItem::ItemParentChange && scene())
    {
        // we need to set this flag to prevent processing ItemPositionHasChanged,
        // because item position at this moment not actual
        mParentChanging = true;
        QGraphicsItem* newParent = value.value<QGraphicsItem*>();
        if(newParent)
            setPos(newParent->mapFromScene(scenePos()));
        else
            setPos(scenePos());
    }

    if (change == QGraphicsItem::ItemParentHasChanged)
    {
        // now item position has valid value
        mParentChanging = false;
        updateConnected();
    }

    // Change stacking order
    if (scene() && change == QGraphicsItem::ItemSelectedHasChanged
                && isSelected() && scene()->selectedItems().size() == 1)
    {
        QGraphicsItem* top = this;
        QList<QGraphicsItem*> lst = scene()->items();
        foreach(QGraphicsItem* it, lst)
        {
            if(it != this &&
               it->type() == type() &&
               it->parentItem() == parentItem())
            {
                it->stackBefore(top);
                top = it;
            }
        }
    }
开发者ID:DenisKlimenko,项目名称:kbe,代码行数:54,代码来源:scgobject.cpp

示例9: scenePos

void Clock::save()
{
    LxQt::Settings *m_config = m_parent->config();
    QString m_configId = m_parent->configId();
    m_config->beginGroup(m_configId);
    m_config->setValue("plugin", "analogclock");
    m_config->setValue("x", scenePos().x());
    m_config->setValue("y", scenePos().y());
    m_config->setValue("showseconds", mShowSeconds);
    m_config->endGroup();
}
开发者ID:zballina,项目名称:lxqt-desktop,代码行数:11,代码来源:clock.cpp

示例10: geometry

void StelAppGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
{
	QGraphicsWidget::resizeEvent(event);
	const float w = geometry().width();
	const float h = geometry().height();
	const float x = scenePos().x();
	const float y = scene()->sceneRect().height() - (scenePos().y() + geometry().height());
	
	stelApp->windowHasBeenResized(x, y, w, h);
	renderer->viewportHasBeenResized(scene()->sceneRect().size().toSize());
}
开发者ID:EvilTosha,项目名称:Stellarium-GSoC12,代码行数:11,代码来源:StelAppGraphicsWidget.cpp

示例11: boundingRect

QPair<QDomElement, Item::DomElementTypes> PointPort::generateItem(QDomDocument &document, const QPoint &topLeftPicture)
{
	QRectF itemBoundingRect = boundingRect().adjusted(scalingDrift, scalingDrift, -scalingDrift, -scalingDrift);
	QDomElement pointPort = document.createElement("pointPort");
	const int x = static_cast<int>(scenePos().x() + itemBoundingRect.x() + mRadius - topLeftPicture.x());
	const int y = static_cast<int>(scenePos().y() + itemBoundingRect.y() + mRadius - topLeftPicture.y());
	pointPort.setAttribute("y", setSingleScaleForDoc(4, x, y));
	pointPort.setAttribute("x", setSingleScaleForDoc(0, x, y));
	pointPort.setAttribute("type", mType);

	return QPair<QDomElement, Item::DomElementTypes>(pointPort, mDomElementType);
}
开发者ID:Antropovi,项目名称:qreal,代码行数:12,代码来源:pointPort.cpp

示例12: scenePos

QPair<QDomElement, Item::DomElementTypes> Line::generateItem(QDomDocument &document, QPointF const &topLeftPicture)
{
    qreal const x1 = scenePos().x() + line().x1() - topLeftPicture.x();
    qreal const y1 = scenePos().y() + line().y1() - topLeftPicture.y();
    qreal const x2 = scenePos().x() + line().x2() - topLeftPicture.x();
    qreal const y2 = scenePos().y() + line().y2() - topLeftPicture.y();

    QDomElement line = setPenBrushToDoc(document, "line");
    setXandY(line, QRectF(x1, y1, x2 - x1, y2 - y1));

    return QPair<QDomElement, Item::DomElementTypes>(line, mDomElementType);
}
开发者ID:nfrey,项目名称:qreal,代码行数:12,代码来源:line.cpp

示例13: QString

/**
	Exporte la borne en XML
	@param xml_document Document XML a utiliser pour creer l'element XML
	@return un element XML decrivant la borne
*/
const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const {
	QDomElement xml_element = xml_document.createElement("terminal");
	
	// ecrit la position de la borne
	xml_element.setAttribute("x", QString("%1").arg(scenePos().x()));
	xml_element.setAttribute("y", QString("%1").arg(scenePos().y()));
	
	// ecrit l'orientation de la borne
	xml_element.setAttribute("orientation", Qet::orientationToString(m_orientation));
	// Write name and number to XML
	
	return(xml_element);
}
开发者ID:wangchenxicool,项目名称:qelectrotech-0.4-src-qt-everywhere,代码行数:18,代码来源:partterminal.cpp

示例14: scene

void StelAppGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
{
	QGraphicsWidget::resizeEvent(event);
	stelApp->glWindowHasBeenResized(scenePos().x(), scene()->sceneRect().height()-(scenePos().y()+geometry().height()), geometry().width(), geometry().height());
	if (backgroundBuffer)
	{
		delete backgroundBuffer;
		backgroundBuffer = NULL;
	}
	if (foregroundBuffer)
	{
		delete foregroundBuffer;
		foregroundBuffer = NULL;
	}
}
开发者ID:Astrocoderguy,项目名称:stellarium,代码行数:15,代码来源:StelAppGraphicsWidget.cpp

示例15: scenePos

void ReportRectEntity::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
    qreal w, h;

    QPointF p  = dynamic_cast<ReportScene*>(scene())->gridPoint(event->scenePos());
    w = p.x() - scenePos().x();
    h = p.y() - scenePos().y();

    //TODO use an enum for the directions

    switch (m_grabAction) {
    case 1:
        if (sceneRect().y() - p.y() + rect().height() > 0 && sceneRect().x() - p.x() + rect().width() > 0)
            setSceneRect(QPointF(p.x(), p.y()), QSizeF(sceneRect().x() - p.x() + rect().width(), sceneRect().y() - p.y() + rect().height()));
        break;
    case 2:
        if (sceneRect().y() - p.y() + rect().height() > 0)
            setSceneRect(QPointF(sceneRect().x(), p.y()), QSizeF(rect().width(), sceneRect().y() - p.y() + rect().height()));
        break;
    case 3:
        if (sceneRect().y() - p.y() + rect().height() > 0 && w > 0)
            setSceneRect(QPointF(sceneRect().x(), p.y()), QSizeF(w, sceneRect().y() - p.y() + rect().height()));
        break;
    case 4:
        if (w > 0)
            setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF(w, (rect().height())));
        break;
    case 5:
        if (h > 0 && w > 0)
            setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF(w, h));
        break;
    case 6:
        if (h > 0)
            setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF((rect().width()), h));
        break;
    case 7:
        if (sceneRect().x() - p.x() + rect().width() > 0 && h > 0)
            setSceneRect(QPointF(p.x(), sceneRect().y()), QSizeF(sceneRect().x() - p.x() + rect().width(), h));
        break;
        break;
    case 8:
        if (sceneRect().x() - p.x() + rect().width() > 0)
            setSceneRect(QPointF(p.x(), sceneRect().y()), QSizeF(sceneRect().x() - p.x() + rect().width(), rect().height()));
        break;
    default:
        QGraphicsItem::mouseMoveEvent(event);
    }
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:48,代码来源:reportrectentity.cpp


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