| 238 | } |
| 239 | |
| 240 | void WorksheetElementContainerPrivate::recalcShapeAndBoundingRect() { |
| 241 | // if (q->isLoading()) |
| 242 | // return; |
| 243 | |
| 244 | // old logic calculating the bounding box as the box covering all children. |
| 245 | // we might need this logic later once we implement something like selection of multiple plots, etc. |
| 246 | // boundingRectangle = QRectF(); |
| 247 | // QVector<WorksheetElement*> childList = q->children<WorksheetElement>(AbstractAspect::IncludeHidden | AbstractAspect::Compress); |
| 248 | // foreach (const WorksheetElement* elem, childList) |
| 249 | // boundingRectangle |= elem->graphicsItem()->mapRectToParent(elem->graphicsItem()->boundingRect()); |
| 250 | // |
| 251 | qreal penWidth = 2.; |
| 252 | m_boundingRectangle = q->rect(); |
| 253 | // QDEBUG(Q_FUNC_INFO << ", bound rect = " << boundingRectangle) |
| 254 | m_boundingRectangle = QRectF(-m_boundingRectangle.width() / 2. - penWidth / 2., |
| 255 | -m_boundingRectangle.height() / 2. - penWidth / 2., |
| 256 | m_boundingRectangle.width() + penWidth, |
| 257 | m_boundingRectangle.height() + penWidth); |
| 258 | |
| 259 | QPainterPath path; |
| 260 | path.addRect(m_boundingRectangle); |
| 261 | |
| 262 | // make the shape somewhat thicker than the hoveredPen to make the selection/hovering box more visible |
| 263 | m_shape = QPainterPath(); |
| 264 | m_shape.addPath(WorksheetElement::shapeFromPath(path, QPen(QBrush(), penWidth))); |
| 265 | } |
| 266 | |
| 267 | // Inherited from QGraphicsItem |
| 268 | QRectF WorksheetElementContainerPrivate::boundingRect() const { |