• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ scenePos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: world

void MainWindow::enterLocation() {
	auto player = world()->player();
	if (!player) {
		qDebug("No player. Will not enter any location");
		return;
	}
	auto global_pos = player->scenePos();
	qDebug() << "Player global position:" << global_pos.x() << global_pos.y();
	auto global_cell = world()->globalField()->cell(global_pos);
	auto local_pos = global_pos * global_cell->sceneMatrix().inverted();
	qDebug() << "Player local position:" << local_pos.x() << local_pos.y();
	if (global_cell) {
		//world()->globalField()->removeItem(player);
		auto v = global_cell->localField();
		connect(v, SIGNAL(toggleInventory(Character*)), ui->m_inventory, SLOT(toggle(Character*)));
		ui->m_render_view->setScene(v);
		//auto s = GLOBAL_FIELD_SIZE / (float)GLOBAL_FIELD_CELL_REAL_SIZE;
		ui->m_render_view->resetTransform();		
		auto local_cell = v->cell(local_pos);
		local_pos = global_pos * local_cell->sceneMatrix().inverted();
		//local_pos = local_pos * cell->sceneMatrix().inverted();
		qDebug() << "Player local local position:" << local_pos.x() << local_pos.y();
		world()->player()->setParentItem(local_cell);
		world()->player()->setPos(local_pos);	
		world()->setLocalField(v);
		if (player)
			ui->m_render_view->centerOn(player);
	}
}
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:29,代码来源:main_window.cpp


示例17: scenePos

void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint & dropPoint)
{
    QPoint point = dropPoint + scenePos().toPoint();
    int x = -1;
    if (settingsCache->getHorizontalHand()) {
        for (x = 0; x < cards.size(); x++)
            if (point.x() < ((CardItem *) cards.at(x))->scenePos().x())
                break;
    } else {
        for (x = 0; x < cards.size(); x++)
            if (point.y() < ((CardItem *) cards.at(x))->scenePos().y())
                break;
    }
    
    Command_MoveCard cmd;
    cmd.set_start_player_id(startZone->getPlayer()->getId());
    cmd.set_start_zone(startZone->getName().toStdString());
    cmd.set_target_player_id(player->getId());
    cmd.set_target_zone(getName().toStdString());
    cmd.set_x(x);
    cmd.set_y(-1);
    
    for (int i = 0; i < dragItems.size(); ++i)
        cmd.mutable_cards_to_move()->add_card()->set_card_id(dragItems[i]->getId());
    
    player->sendGameCommand(cmd);
}
开发者ID:Grim-the-Reaper,项目名称:Cockatrice,代码行数:27,代码来源:handzone.cpp


示例18: while

void LinkDialogGraphicsScene::offsetItems(float yIncrement, bool scrollLeft) {
    auto proc = scrollLeft ? srcProcessor_ : dstProcessor_;

    auto items = proc->getPropertyItemList();
    while (!items.empty() && items.back()->hasSubProperties() && items.back()->isExpanded()) {
        items = items.back()->getSubPropertyItemList();
    }
    qreal miny = std::numeric_limits<double>::lowest();
    if (!items.empty()) {
        miny = items.back()->scenePos().y();
    }

    auto view = views().front();
    auto top = view->mapToScene(QPoint(0, 0)).y();

    QPointF pos = proc->scenePos();
    qreal newy = std::min(pos.y() + yIncrement,
                          top + static_cast<qreal>(linkdialog::processorHeight));

    qreal listHeight = miny - pos.y();
    newy = std::max(newy, top - (listHeight - linkdialog::processorHeight));
    proc->setPos(pos.x(), newy);

    update();
}
开发者ID:cgloger,项目名称:inviwo,代码行数:25,代码来源:linkdialogscene.cpp


示例19: scenePos

/**
 * Sets 'y' coordinate  of end of line.
 *
 * @param yPos This represents 'y' in scene coords which will become
 *             end of line.
 */
void SeqLineWidget::setEndOfLine(qreal yPos)
{
    qreal len = yPos - scenePos().y();
//:TODO:    if (len > 0.0) {
        setLength(len);
//    }
}
开发者ID:jpleclerc,项目名称:Umbrello-ng2,代码行数:13,代码来源:seqlinewidget.cpp


示例20: Q_UNUSED

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

    QSettings settings;
    _font = settings.value("Visualisation/Font", QFont("sans-serif", 10)).value<QFont>();
    int displayOptions = settings.value("Visualisation/Grouping/DisplayOptions", (DisplayCapturing | DisplayNamed)).toInt();
    double horizontalPadding = settings.value("Visualisation/Grouping/HorizontalPadding", 8.0).toDouble();
    double verticalPadding   = settings.value("Visualisation/Grouping/VerticalPadding", 6.0).toDouble();
    double cornerRadius   = settings.value("Visualisation/Grouping/CornerRadius", 5.0).toDouble();
    QColor bgColor = settings.value("Visualisation/Grouping/Color", QColor(245,245,245)).value<QColor>();

    painter->setFont(_font);
    painter->setBrush(bgColor);
    painter->setPen(Qt::black);

    if((_capturing && (displayOptions & DisplayCapturing))
            || (!_capturing && (displayOptions & DisplayNonCapturing))
            || (!_name.isEmpty() && (displayOptions & DisplayNamed))
            )
    {
        QRectF drawRect = boundingRect();
        // Align the rect to the pixel grid
        if(qRound(scenePos().x()) == scenePos().x())
        {
            drawRect.setX(0.5);
            drawRect.setWidth(drawRect.width()-.5);
        }
        if(qRound(scenePos().y()) == scenePos().y())
        {
            drawRect.setHeight(drawRect.height()-.5);
            drawRect.setY(0.5);
        }
        painter->drawRoundedRect(drawRect, cornerRadius, cornerRadius);

        if(!_name.isEmpty())
            painter->drawText(QRectF(
                                  horizontalPadding,
                                  verticalPadding,
                                  _metrics.width(_title),
                                  _metrics.height()),
                              Qt::AlignCenter,
                              _title);
    }
}
开发者ID:aelliott,项目名称:expressioneditor,代码行数:46,代码来源:groupinggraphicsitem.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sceneRect函数代码示例发布时间:2022-05-30
下一篇:
C++ scene函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap