void SquareRootElement::layout( const AttributeManager* am ) { RowElement::layout( am ); qreal thinSpace = am->layoutSpacing( this ); qreal symbolHeight = baseLine(); if( height() > symbolHeight*1.3 ) symbolHeight = height(); symbolHeight += thinSpace; qreal tickWidth = symbolHeight / 3.0; m_lineThickness = am->lineThickness(this); // Set the sqrt dimensions QPointF childOffset( tickWidth + thinSpace, thinSpace + m_lineThickness ); setWidth( width() + childOffset.x()); setHeight( height() + childOffset.y()); setBaseLine( baseLine() + childOffset.y()); // Adapt the children's positions to the new offset foreach( BasicElement* element, childElements() ) element->setOrigin( element->origin() + childOffset ); QRectF rect = childrenBoundingRect(); rect.translate(childOffset); setChildrenBoundingRect(rect); // Draw the sqrt symbol into a QPainterPath as buffer m_rootSymbol = QPainterPath(); m_rootSymbol.moveTo( m_lineThickness, 2.0 * symbolHeight / 3.0 ); m_rootSymbol.lineTo( 0 + tickWidth/2.0, symbolHeight-m_lineThickness/2 ); m_rootSymbol.lineTo( 0 + tickWidth, m_lineThickness/2 ); m_rootSymbol.lineTo( width() - m_lineThickness/2, m_lineThickness/2 ); }
void ToolBoxGraphicsItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { painter->save(); painter->setPen(Qt::NoPen); painter->setBrush(QBrush(QColor(0xFF, 0xE2, 0x82))); painter->drawRect(childrenBoundingRect()); painter->restore(); QGraphicsItemGroup::paint(painter, option, widget); }
GraphicsKeyboardItem::GraphicsKeyboardItem(unsigned char channel_, QGraphicsItem *parent) : QGraphicsRectItem(parent), channel(channel_), activeKey(0) { QSizeF whiteKeySize(20, 100); // create keys: for (int i = 0; i < 128; i++) { keys.append(new GraphicsKeyItem(i, whiteKeySize, this)); } setRect(childrenBoundingRect()); setBrush(QBrush(Qt::white)); }
void UBGraphicsGroupContainerItem::removeFromGroup(QGraphicsItem *item) { if (!item) { qWarning("QGraphicsItemGroup::removeFromGroup: cannot remove null item"); return; } QGraphicsItem *newParent = parentItem(); // COMBINE bool ok; QTransform itemTransform; if (newParent) itemTransform = item->itemTransform(newParent, &ok); else itemTransform = item->sceneTransform(); QPointF oldPos = item->mapToItem(newParent, 0, 0); item->setParentItem(newParent); item->setPos(oldPos); // removing position from translation component of the new transform if (!item->pos().isNull()) itemTransform *= QTransform::fromTranslate(-item->x(), -item->y()); // removing additional transformations properties applied // with itemTransform() or sceneTransform() QPointF origin = item->transformOriginPoint(); QMatrix4x4 m; QList<QGraphicsTransform*> transformList = item->transformations(); for (int i = 0; i < transformList.size(); ++i) transformList.at(i)->applyTo(&m); itemTransform *= m.toTransform().inverted(); itemTransform.translate(origin.x(), origin.y()); itemTransform.rotate(-item->rotation()); itemTransform.scale(1 / item->scale(), 1 / item->scale()); itemTransform.translate(-origin.x(), -origin.y()); // ### Expensive, we could maybe use dirtySceneTransform bit for optimization item->setTransform(itemTransform); // item->d_func()->setIsMemberOfGroup(item->group() != 0); // ### Quite expensive. But removeFromGroup() isn't called very often. prepareGeometryChange(); itemsBoundingRect = childrenBoundingRect(); }
QRectF LiveLayerItem::boundingRect() const { return childrenBoundingRect(); }
QRectF AnnotationItem::boundingRect() const { return childrenBoundingRect(); }
QRectF AlignButtonsItem::boundingRect() const { return childrenBoundingRect(); }
QRectF StickMan::boundingRect() const { // account for head radius=50.0 plus pen which is 5.0 return childrenBoundingRect().adjusted(-55.0, -55.0, 55.0, 55.0); }
QRectF ActiveGraphicsItem::boundingRect() const { return childrenBoundingRect(); }
QRectF BoundaryItem::boundingRect() const { return childrenBoundingRect(); }
/*! * \brief Module::boundingRect * \return the bounding rectangle for the module */ QRectF Module::boundingRect() const { return rect().united(childrenBoundingRect()); }
QRectF HelpItem::boundingRect() const { QRectF r = childrenBoundingRect ().adjusted(-12, -12, 12, 12); r.moveCenter(QPointF()); return r; }
QRectF boundingRect() const override { return childrenBoundingRect(); }
QRectF ArrowItem::boundingRect() const { return childrenBoundingRect(); }
QRectF dmz::QtCanvasObject::boundingRect () const { return childrenBoundingRect (); }