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

C++ prepareGeometryChange函数代码示例

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

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



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

示例1: prepareGeometryChange

void Pixmap::setPixmap(const QPixmap &pixmap){
    this->pixmap = pixmap;
    prepareGeometryChange();
}
开发者ID:gaodayihao,项目名称:GSanguosha,代码行数:4,代码来源:pixmap.cpp


示例2: prepareGeometryChange

void QAttribute::Repaint()
    {
        prepareGeometryChange();
        update(boundingRect());
    }
开发者ID:Lavoro922,项目名称:Erd-Creator,代码行数:5,代码来源:QTable.cpp


示例3: setSizeChanged

 void setSizeChanged(const IntSize& newSize)
 {
     prepareGeometryChange();
     m_size = newSize;
 }
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:5,代码来源:PageClientQt.cpp


示例4: prepareGeometryChange

void ConstraintView::setHeight(double height)
{
    prepareGeometryChange();
    m_height = height;
}
开发者ID:OpenDAWN,项目名称:i-score,代码行数:5,代码来源:ConstraintView.cpp


示例5: prepareGeometryChange

void Label::setText(const QString& text) 
{ 
    m_textItem->setText(text);
    prepareGeometryChange();
}
开发者ID:Suneal,项目名称:qt,代码行数:5,代码来源:label.cpp


示例6: prepareGeometryChange

void GraphicsPolyLineItem::setPolyLine(const PolyLine &polyLine)
{
  prepareGeometryChange();
  m_polyLine = polyLine;
}
开发者ID:Ulle84,项目名称:UllesSourceCode,代码行数:5,代码来源:GraphicsPolyLineItem.cpp


示例7: prepareGeometryChange

void ShaderNodeUI::publicPrepareGeometryChange()
{
	prepareGeometryChange();
}
开发者ID:ppearson,项目名称:ImaginePartial,代码行数:4,代码来源:shader_node_view_items.cpp


示例8: prepareGeometryChange

void SGI_Symbol::updateCacheAndRepaint() noexcept {
  prepareGeometryChange();

  mBoundingRect = QRectF();

  mShape = QPainterPath();
  mShape.setFillRule(Qt::WindingFill);

  // cross rect
  QRectF crossRect(-4, -4, 8, 8);
  mBoundingRect = mBoundingRect.united(crossRect);
  mShape.addRect(crossRect);

  // polygons
  for (const Polygon& polygon : mLibSymbol.getPolygons()) {
    // query polygon path and line width
    QPainterPath polygonPath = polygon.getPath().toQPainterPathPx();
    qreal        w           = polygon.getLineWidth()->toPx() / 2;

    // update bounding rectangle
    mBoundingRect =
        mBoundingRect.united(polygonPath.boundingRect().adjusted(-w, -w, w, w));

    // update shape
    if (polygon.isGrabArea()) {
      QPainterPathStroker stroker;
      stroker.setCapStyle(Qt::RoundCap);
      stroker.setJoinStyle(Qt::RoundJoin);
      stroker.setWidth(2 * w);
      // add polygon area
      mShape = mShape.united(polygonPath);
      // add stroke area
      mShape = mShape.united(stroker.createStroke(polygonPath));
    }
  }

  // circles
  for (const Circle& circle : mLibSymbol.getCircles()) {
    // get circle radius, including compensation for the stroke width
    qreal w = circle.getLineWidth()->toPx() / 2;
    qreal r = circle.getDiameter()->toPx() / 2 + w;

    // get the bounding rectangle for the circle
    QPointF center = circle.getCenter().toPxQPointF();
    QRectF  boundingRect =
        QRectF(QPointF(center.x() - r, center.y() - r), QSizeF(r * 2, r * 2));

    // update bounding rectangle
    mBoundingRect = mBoundingRect.united(boundingRect);

    // update shape
    if (circle.isGrabArea()) {
      mShape.addEllipse(circle.getCenter().toPxQPointF(), r, r);
    }
  }

  // texts
  mCachedTextProperties.clear();
  for (const Text& text : mLibSymbol.getTexts()) {
    // create static text properties
    CachedTextProperties_t props;

    // get the text to display
    props.text = AttributeSubstitutor::substitute(text.getText(), &mSymbol);

    // calculate font metrics
    props.fontPixelSize = qCeil(text.getHeight()->toPx());
    mFont.setPixelSize(props.fontPixelSize);
    QFontMetricsF metrics(mFont);
    props.scaleFactor = text.getHeight()->toPx() / metrics.height();
    props.textRect    = metrics.boundingRect(
        QRectF(), text.getAlign().toQtAlign() | Qt::TextDontClip, props.text);
    QRectF scaledTextRect =
        QRectF(props.textRect.topLeft() * props.scaleFactor,
               props.textRect.bottomRight() * props.scaleFactor);

    // check rotation
    Angle absAngle = text.getRotation() + mSymbol.getRotation();
    absAngle.mapTo180deg();
    props.mirrored = mSymbol.getMirrored();
    if (!props.mirrored)
      props.rotate180 =
          (absAngle <= -Angle::deg90() || absAngle > Angle::deg90());
    else
      props.rotate180 =
          (absAngle < -Angle::deg90() || absAngle >= Angle::deg90());

    // calculate text position
    scaledTextRect.translate(text.getPosition().toPxQPointF());

    // text alignment
    if (props.rotate180)
      props.flags = text.getAlign().mirrored().toQtAlign();
    else
      props.flags = text.getAlign().toQtAlign();

    // calculate text bounding rect
    mBoundingRect  = mBoundingRect.united(scaledTextRect);
    props.textRect = QRectF(scaledTextRect.topLeft() / props.scaleFactor,
                            scaledTextRect.bottomRight() / props.scaleFactor);
//.........这里部分代码省略.........
开发者ID:LibrePCB,项目名称:LibrePCB,代码行数:101,代码来源:sgi_symbol.cpp


示例9: prepareGeometryChange

void PolyQtAnnotation::finish() {
  prepareGeometryChange();
  _closed = true;
  onCoordinatesChanged();
}
开发者ID:Kvit,项目名称:ASAP,代码行数:5,代码来源:PolyQtAnnotation.cpp


示例10: prepareGeometryChange

// setting functions
void Node::setText(const QString &new_text)
{
    prepareGeometryChange(); // for resize event to be raised
        text = new_text;
    update();
}
开发者ID:Atronax,项目名称:Planndo,代码行数:7,代码来源:node.cpp


示例11: prepareGeometryChange

void FootprintPreviewGraphicsItem::updateCacheAndRepaint() noexcept
{
    prepareGeometryChange();

    mBoundingRect = QRectF();
    mShape = QPainterPath();
    mShape.setFillRule(Qt::WindingFill);

    // cross rect
    QRectF crossRect(-4, -4, 8, 8);
    mBoundingRect = mBoundingRect.united(crossRect);
    mShape.addRect(crossRect);

    // polygons
    for (int i = 0; i < mFootprint.getPolygonCount(); i++)
    {
        const Polygon* polygon = mFootprint.getPolygon(i);
        Q_ASSERT(polygon); if (!polygon) continue;

        QPainterPath polygonPath = polygon->toQPainterPathPx();
        qreal w = polygon->getLineWidth().toPx() / 2;
        mBoundingRect = mBoundingRect.united(polygonPath.boundingRect().adjusted(-w, -w, w, w));
        if (polygon->isGrabArea()) mShape = mShape.united(polygonPath);
    }

    // texts
    mCachedTextProperties.clear();
    for (int i = 0; i < mFootprint.getTextCount(); i++)
    {
        const Text* text = mFootprint.getText(i);
        Q_ASSERT(text); if (!text) continue;

        // create static text properties
        CachedTextProperties_t props;

        // get the text to display
        props.text = text->getText();
        replaceVariablesWithAttributes(props.text, false);

        // calculate font metrics
        mFont.setPointSizeF(text->getHeight().toPx());
        QFontMetricsF metrics(mFont);
        props.fontSize = text->getHeight().toPx()*0.8*text->getHeight().toPx()/metrics.height();
        mFont.setPointSizeF(props.fontSize);
        metrics = QFontMetricsF(mFont);
        props.textRect = metrics.boundingRect(QRectF(), text->getAlign().toQtAlign() |
                                              Qt::TextDontClip, props.text);

        // check rotation
        Angle absAngle = text->getRotation() + Angle::fromDeg(rotation());
        absAngle.mapTo180deg();
        props.rotate180 = (absAngle <= -Angle::deg90() || absAngle > Angle::deg90());

        // calculate text position
        qreal dx, dy;
        if (text->getAlign().getV() == VAlign::top())
            dy = text->getPosition().toPxQPointF().y()-props.textRect.top();
        else if (text->getAlign().getV() == VAlign::bottom())
            dy = text->getPosition().toPxQPointF().y()-props.textRect.bottom();
        else
            dy = text->getPosition().toPxQPointF().y()-(props.textRect.top()+props.textRect.bottom())/2;
        if (text->getAlign().getH() == HAlign::left())
            dx = text->getPosition().toPxQPointF().x()-props.textRect.left();
        else if (text->getAlign().getH() == HAlign::right())
            dx = text->getPosition().toPxQPointF().x()-props.textRect.right();
        else
            dx = text->getPosition().toPxQPointF().x()-(props.textRect.left()+props.textRect.right())/2;

        // text alignment
        if (props.rotate180)
        {
            props.align = 0;
            if (text->getAlign().getV() == VAlign::top()) props.align |= Qt::AlignBottom;
            if (text->getAlign().getV() == VAlign::center()) props.align |= Qt::AlignVCenter;
            if (text->getAlign().getV() == VAlign::bottom()) props.align |= Qt::AlignTop;
            if (text->getAlign().getH() == HAlign::left()) props.align |= Qt::AlignRight;
            if (text->getAlign().getH() == HAlign::center()) props.align |= Qt::AlignHCenter;
            if (text->getAlign().getH() == HAlign::right()) props.align |= Qt::AlignLeft;
        }
        else
            props.align = text->getAlign().toQtAlign();

        // calculate text bounding rect
        props.textRect = props.textRect.translated(dx, dy).normalized();
        mBoundingRect = mBoundingRect.united(props.textRect);
        if (props.rotate180)
        {
            props.textRect = QRectF(-props.textRect.x(), -props.textRect.y(),
                                    -props.textRect.width(), -props.textRect.height()).normalized();
        }

        // save properties
        mCachedTextProperties.insert(text, props);
    }

    update();
}
开发者ID:The-Compiler,项目名称:LibrePCB,代码行数:97,代码来源:footprintpreviewgraphicsitem.cpp


示例12: Q_UNUSED

void AbstractScrollArea::scrollContentsBy(qreal dx, qreal dy)
{
    Q_UNUSED(dx)
    Q_UNUSED(dy)
    prepareGeometryChange();
}
开发者ID:Suneal,项目名称:qt,代码行数:6,代码来源:abstractscrollarea.cpp


示例13: prepareGeometryChange

void StickMan::childPositionChanged()
{
    prepareGeometryChange();
}
开发者ID:paspeur,项目名称:ev3sources,代码行数:4,代码来源:stickman.cpp


示例14: iroundf

void OverlayUser::updateLayout() {
	QPixmap pm;

	if (scene())
		uiSize = iroundf(scene()->sceneRect().height() + 0.5);

	prepareGeometryChange();

	for (int i=0;i<4;++i)
		qgpiName[i]->setPixmap(pm);

	qgpiAvatar->setPixmap(pm);
	qgpiChannel->setPixmap(pm);

	{
		QImageReader qir(QLatin1String("skin:muted_self.svg"));
		QSize sz = qir.size();
		sz.scale(SCALESIZE(MutedDeafened), Qt::KeepAspectRatio);
		qir.setScaledSize(sz);
		qgpiMuted->setPixmap(QPixmap::fromImage(qir.read()));
	}

	{
		QImageReader qir(QLatin1String("skin:deafened_self.svg"));
		QSize sz = qir.size();
		sz.scale(SCALESIZE(MutedDeafened), Qt::KeepAspectRatio);
		qir.setScaledSize(sz);
		qgpiDeafened->setPixmap(QPixmap::fromImage(qir.read()));
	}

	qgpiMuted->setPos(alignedPosition(scaledRect(os->qrfMutedDeafened, uiSize * os->fZoom), qgpiMuted->boundingRect(), os->qaMutedDeafened));
	qgpiMuted->setZValue(1.0f);
	qgpiMuted->setOpacity(os->fMutedDeafened);

	qgpiDeafened->setPos(alignedPosition(scaledRect(os->qrfMutedDeafened, uiSize * os->fZoom), qgpiDeafened->boundingRect(), os->qaMutedDeafened));
	qgpiDeafened->setZValue(1.0f);
	qgpiDeafened->setOpacity(os->fMutedDeafened);

	qgpiAvatar->setPos(0.0f, 0.0f);
	qgpiAvatar->setOpacity(os->fAvatar);

	for (int i=0;i<4;++i) {
		qgpiName[i]->setPos(0.0f, 0.0f);
		qgpiName[i]->setZValue(2.0f);
		qgpiName[i]->setOpacity(os->fUserName);
	}
	qgpiChannel->setPos(0.0f, 0.0f);
	qgpiChannel->setZValue(3.0f);
	qgpiChannel->setOpacity(os->fChannel);

	QRectF childrenBounds = os->qrfAvatar | os->qrfChannel | os->qrfMutedDeafened | os->qrfUserName;

	bool haspen = (os->qcBoxPen != os->qcBoxFill) && (! qFuzzyCompare(os->qcBoxPen.alphaF(), static_cast<qreal>(0.0f)));
	qreal pw = haspen ? qMax<qreal>(1.0f, os->fBoxPenWidth * uiSize * os->fZoom) : 0.0f;
	qreal pad = os->fBoxPad * uiSize * os->fZoom;
	QPainterPath pp;
	pp.addRoundedRect(childrenBounds.x() * uiSize * os->fZoom + -pw / 2.0f - pad, childrenBounds.y() * uiSize * os->fZoom + -pw / 2.0f - pad, childrenBounds.width() * uiSize * os->fZoom + pw + 2.0f * pad, childrenBounds.height() * uiSize * os->fZoom + pw + 2.0f * pad, 2.0f * pw, 2.0f * pw);
	qgpiBox->setPath(pp);
	qgpiBox->setPos(0.0f, 0.0f);
	qgpiBox->setZValue(-1.0f);
	qgpiBox->setPen(haspen ? QPen(os->qcBoxPen, pw) : Qt::NoPen);
	qgpiBox->setBrush(qFuzzyCompare(os->qcBoxFill.alphaF(), static_cast<qreal>(0.0f)) ? Qt::NoBrush : os->qcBoxFill);
	qgpiBox->setOpacity(1.0f);

	if (! cuUser) {
		switch (tsColor) {
			case Settings::Passive:
				qsName = Overlay::tr("Silent");
				break;
			case Settings::Talking:
				qsName = Overlay::tr("Talking");
				break;
			case Settings::Whispering:
				qsName = Overlay::tr("Whisper");
				break;
			case Settings::Shouting:
				qsName = Overlay::tr("Shout");
				break;
		}
	}
}
开发者ID:davidebeatrici,项目名称:mumble,代码行数:81,代码来源:OverlayUser.cpp


示例15: prepareGeometryChange

void GraphicEventItem::change(){
	prepareGeometryChange();
}
开发者ID:LamarqueBastien,项目名称:XEML-Lab,代码行数:3,代码来源:graphiceventitem.cpp


示例16: prepareGeometryChange

void BlackEdgeTextItem::setSkip(int skip){
    this->skip = skip;
    prepareGeometryChange();

    Config.setValue("CardEditor/" + objectName() + "Skip", skip);
}
开发者ID:yuanshu,项目名称:QSanguosha,代码行数:6,代码来源:cardeditor.cpp


示例17: prepareGeometryChange

void HandZone::updateOrientation()
{
    prepareGeometryChange();
    reorganizeCards();
}
开发者ID:Grim-the-Reaper,项目名称:Cockatrice,代码行数:5,代码来源:handzone.cpp


示例18: prepareGeometryChange

void DhQGraphicsItemGroup::DvhprepareGeometryChange() {
  return prepareGeometryChange();
}
开发者ID:uduki,项目名称:hsQt,代码行数:3,代码来源:QGraphicsItemGroup_DhClass.cpp


示例19: prepareGeometryChange

//!
//! Updates the path end points according to the positions of start and end
//! nodes.
//!
void ConnectionGraphicsItem::updatePath ()
{
    prepareGeometryChange();

    // calculate positions of the end points
    QPointF startPoint = m_startPoint;
    QPointF endPoint = m_endPoint;
    if (m_startNodeItem)
        startPoint += m_startNodeItem->pos();
    if (m_endNodeItem)
        endPoint += m_endNodeItem->pos();

    // calculate the rectangles to help calculating the positions of the node's anchor points
    const qreal offset = 10;
    QRectF baseAnchorRect = QRectF(-offset, -offset, 2 * offset, 2 * offset);
    QRectF startAnchorRect = baseAnchorRect.translated(startPoint);
    QRectF endAnchorRect = baseAnchorRect.translated(endPoint);
    if (m_startNodeItem)
        startAnchorRect = m_startNodeItem->rect().adjusted(-offset, -offset, offset, offset).translated(m_startNodeItem->pos());
    if (m_endNodeItem)
        endAnchorRect = m_endNodeItem->rect().adjusted(-offset, -offset, offset, offset).translated(m_endNodeItem->pos());

    //
    // Diagram of anchor points for start and end nodes:
    //
    //    x        x      sU2, sU1     eU1, eU2      x        x
    //      ,----,                                     ,----,
    //      |    |                                     |    |
    //      |    |                                     |    |
    //      |   x| x      sP, sO         eO, eP      x |x   |
    //      '----'                                     '----'
    //    x        x      sL2, sL1     eL1, eL2      x        x
    //

    QPointF sP = startPoint;
    QPointF sO = QPointF(startAnchorRect.right(), startPoint.y());
    QPointF sU1 = startAnchorRect.topRight();
    QPointF sU2 = startAnchorRect.topLeft();
    QPointF sL1 = startAnchorRect.bottomRight();
    QPointF sL2 = startAnchorRect.bottomLeft();

    QPointF eP = endPoint;
    QPointF eO = QPointF(endAnchorRect.left(), endPoint.y());
    QPointF eU1 = endAnchorRect.topLeft();
    QPointF eU2 = endAnchorRect.topRight();
    QPointF eL1 = endAnchorRect.bottomLeft();
    QPointF eL2 = endAnchorRect.bottomRight();

    // declare path segments
    QList<QPointF> startPoints;
    QPainterPath cubicPath;
    QList<QPointF> endPoints;

    // construct the path segments
    if (eO.x() < sO.x() && eU2.x() > sL2.x() && eU2.y() < sL2.y() && eL2.y() > sU2.y()) {
        //> case 1V: elements very close to each other
        startPoints << sP << sO;

        QPointF offsetVector = QPointF(0, 0.75 * (eO.y() - sO.y()));
        cubicPath.moveTo(sO);
        cubicPath.cubicTo(sO + offsetVector, eO - offsetVector, eO);

        endPoints << eO << eP;
    } else if (eO.x() >= sO.x()) {
        //> case 1H: end node is right of start node
        startPoints << sP << sO;

        QPointF offsetVector = QPointF(0.75 * (eO.x() - sO.x()), 0);
        cubicPath.moveTo(sO);
        cubicPath.cubicTo(sO + offsetVector, eO - offsetVector, eO);

        endPoints << eO << eP;
    } else if (eU1.y() >= sL1.y()) {
        //> case 2LV
        startPoints << sP << sO << sL1;

        QPointF offsetVector = QPointF(0, 0.75 * (eU1.y() - sL1.y()));
        cubicPath.moveTo(sL1);
        cubicPath.cubicTo(sL1 + offsetVector, eU1 - offsetVector, eU1);

        endPoints << eU1 << eO << eP;
    } else if (eL1.y() <= sU1.y()) {
        //> case 2UV
        startPoints << sP << sO << sU1;

        QPointF offsetVector = QPointF(0, 0.75 * (eL1.y() - sU1.y()));
        cubicPath.moveTo(sU1);
        cubicPath.cubicTo(sU1 + offsetVector, eL1 - offsetVector, eL1);

        endPoints << eL1 << eO << eP;
    } else if (eP.y() >= sP.y()) {
        //> case 3L
        startPoints << sP << sO << sL1 << sL2;

        QPointF offsetVector = QPointF(0.75 * (eU2.x() - sL2.x()), 0);
        cubicPath.moveTo(sL2);
//.........这里部分代码省略.........
开发者ID:banduladh,项目名称:levelfour,代码行数:101,代码来源:ConnectionGraphicsItem.cpp


示例20: prepareGeometryChange

void MeasureGraphicsItem::setRect(const QRectF& rect)
{
  prepareGeometryChange();
  m_rect = rect;
  update();
}
开发者ID:aitjcize,项目名称:QCamber,代码行数:6,代码来源:measuregraphicsitem.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ prepareItems函数代码示例发布时间:2022-05-30
下一篇:
C++ prepareForFeature函数代码示例发布时间: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