本文整理汇总了C++中prepareGeometryChange函数的典型用法代码示例。如果您正苦于以下问题:C++ prepareGeometryChange函数的具体用法?C++ prepareGeometryChange怎么用?C++ prepareGeometryChange使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepareGeometryChange函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareGeometryChange
void Pixmap::setPixmap(const QPixmap &pixmap){
this->pixmap = pixmap;
prepareGeometryChange();
}
示例2: prepareGeometryChange
void QAttribute::Repaint()
{
prepareGeometryChange();
update(boundingRect());
}
示例3: setSizeChanged
void setSizeChanged(const IntSize& newSize)
{
prepareGeometryChange();
m_size = newSize;
}
示例4: prepareGeometryChange
void ConstraintView::setHeight(double height)
{
prepareGeometryChange();
m_height = height;
}
示例5: prepareGeometryChange
void Label::setText(const QString& text)
{
m_textItem->setText(text);
prepareGeometryChange();
}
示例6: prepareGeometryChange
void GraphicsPolyLineItem::setPolyLine(const PolyLine &polyLine)
{
prepareGeometryChange();
m_polyLine = polyLine;
}
示例7: prepareGeometryChange
void ShaderNodeUI::publicPrepareGeometryChange()
{
prepareGeometryChange();
}
示例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);
//.........这里部分代码省略.........
示例9: prepareGeometryChange
void PolyQtAnnotation::finish() {
prepareGeometryChange();
_closed = true;
onCoordinatesChanged();
}
示例10: prepareGeometryChange
// setting functions
void Node::setText(const QString &new_text)
{
prepareGeometryChange(); // for resize event to be raised
text = new_text;
update();
}
示例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();
}
示例12: Q_UNUSED
void AbstractScrollArea::scrollContentsBy(qreal dx, qreal dy)
{
Q_UNUSED(dx)
Q_UNUSED(dy)
prepareGeometryChange();
}
示例13: prepareGeometryChange
void StickMan::childPositionChanged()
{
prepareGeometryChange();
}
示例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;
}
}
}
示例15: prepareGeometryChange
void GraphicEventItem::change(){
prepareGeometryChange();
}