//! Wrapper for QPainter::fillRect() void QwtPainter::fillRect( QPainter *painter, const QRectF &rect, const QBrush &brush ) { if ( !rect.isValid() ) return; QRectF clipRect; const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect ); /* Performance of Qt4 is horrible for a non trivial brush. Without clipping expect minutes or hours for repainting large rectangles (might result from zooming) */ if ( deviceClipping ) clipRect &= painter->window(); else clipRect = painter->window(); if ( painter->hasClipping() ) clipRect &= painter->clipRegion().boundingRect(); QRectF r = rect; if ( deviceClipping ) r = r.intersected( clipRect ); if ( r.isValid() ) painter->fillRect( r, brush ); }
void MFreestyleLayoutPolicy::relayout() { Q_D(MFreestyleLayoutPolicy); QPointF topLeft = contentsArea().topLeft(); QList<QRectF> new_geometries; const int size = count(); for (int i = 0; i < size; ++i) { new_geometries << itemGeometry(i); d->placeItem(i, new_geometries, topLeft, contentsArea().width()); } QRectF area = contentsArea(); for (int i = 0; i < size; ++i) { area = area.united(new_geometries.at(i)); setItemGeometry(i, new_geometries.at(i)); } //if we have moved items outside of the bounding box, we need to invalidate the layout //causing another relayout, but we have to be careful that we don't end up in an //infinite loop because of this. if (area.isValid() && !contentsArea().adjusted(-0.0000001, -0.0000001, 0.0000001, 0.0000001).contains(area)) //adjust for rounding errors updateGeometry(); }
void DrawRectangleTool::updateDirtyRect() { QRectF rect; includePreviewRects(rect); if (shift_pressed) snap_helper->includeDirtyRect(rect); if (is_helper_tool) emit(dirtyRectChanged(rect)); else { if (angle_helper->isActive()) angle_helper->includeDirtyRect(rect); if (rect.isValid()) { float helper_cross_radius = Settings::getInstance().getRectangleToolHelperCrossRadiusPx(); int pixel_border = 0; if (editingInProgress()) pixel_border = helper_cross_radius; // helper_cross_radius as border is less than ideal but the only way to always ensure visibility of the helper cross at the moment if (angle_helper->isActive()) pixel_border = qMax(pixel_border, angle_helper->getDisplayRadius()); map()->setDrawingBoundingBox(rect, pixel_border, true); } else map()->clearDrawingBoundingBox(); } }
void GInstructionView::FitInstructionInView() { if(!m_pInstruction || !m_pInsScene) return; // setSceneRect(m_pInstruction->BoundingSceneRect()); fitInView(&m_pInstruction->m_GraphicsItem); QRectF SceneRect = sceneRect(); if(!SceneRect.isValid()) return; // we don't want blank areas at the beginning or at the ending of the G_old_Instruction in the QGraphicsView // so here is what we are going to do: we will see what is the viewport coordinate in the scene,... // then, we will add 1 or so, and change the scene coordinate so that it corresponds to the beginning/ending of the G_old_Instruction fitInView(SceneRect); QRect geomView = geometry(); int Xini = -1; int Xfin = geomView.width() - 3; if(Xfin <= 2) return; double Xiniscene = mapToScene(Xini, 0).rx(); double Xfinscene = mapToScene(Xfin, 0).rx() - m_pInstruction->Duration(); SceneRect.adjust(- Xiniscene, 0, - Xfinscene, 0); setSceneRect(SceneRect); fitInView(SceneRect); }
void DrawPathTool::updateDirtyRect() { QRectF rect; if (dragging) { rectIncludeSafe(rect, click_pos_map); rectInclude(rect, cur_pos_map); } if (editingInProgress() && previous_point_is_curve_point) { rectIncludeSafe(rect, previous_pos_map); rectInclude(rect, previous_drag_map); } if ((editingInProgress() && !dragging) || (!editingInProgress() && !shift_pressed && ctrl_pressed) || (!editingInProgress() && (picking_angle || picked_angle))) { angle_helper->includeDirtyRect(rect); } if (shift_pressed || (!editingInProgress() && ctrl_pressed)) snap_helper->includeDirtyRect(rect); includePreviewRects(rect); if (is_helper_tool) emit(dirtyRectChanged(rect)); else { if (rect.isValid()) map()->setDrawingBoundingBox(rect, qMax(qMax(dragging ? 1 : 0, angle_helper->getDisplayRadius()), snap_helper->getDisplayRadius()), true); else map()->clearDrawingBoundingBox(); } }
void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea) { if (!targetArea.isValid()) return; if (scrollAnimationActive() || scaleAnimationActive()) return; const int margin = 10; // We want at least a little bit or margin. QRectF endArea = itemRectFromCSS(targetArea.adjusted(-margin, -margin, margin, margin)); const QRectF viewportRect = m_viewport->boundingRect(); qreal targetCSSScale = cssScaleFromItem(viewportRect.size().width() / endArea.size().width()); qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5)))); // We want to end up with the target area filling the whole width of the viewport (if possible), // and centralized vertically where the user requested zoom. Thus our hotspot is the center of // the targetArea x-wise and the requested zoom position, y-wise. const QPointF hotspot = QPointF(endArea.center().x(), touchPoint.y() * m_constraints.devicePixelRatio); const QPointF viewportHotspot = viewportRect.center(); QPointF endPosition = hotspot * endItemScale - viewportHotspot; QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); animateItemRectVisible(endVisibleContentRect); }
void PdfThumbProvider::updateVisibleAreas() { clearVisibleAreas(); QRectF sceneRect; QList<QGraphicsItem *> visibleItems; if(0 != data->scene) { //MSceneManager * sceneManager = MApplication::activeApplicationWindow()->sceneManager(); //QSizeF size = sceneManager->visibleSceneSize(M::Landscape); QSizeF size = ApplicationWindow::visibleSize(M::Landscape); sceneRect = QRectF(QPoint(0,0), size); visibleItems = data->scene->items(sceneRect, Qt::IntersectsItemBoundingRect); } foreach(QGraphicsItem * item, visibleItems) { ThumbWidget *newitem = qgraphicsitem_cast<ThumbWidget *>(item); if(0 != newitem && data->widgetName == newitem->objectName()) { //Lets get sceneRect in wigdets coodinate QRectF temp= newitem->mapRectFromScene(sceneRect); //Lets get intersecting between sceneRect and widgets area QRectF visibleArea = temp.intersected(newitem->rect()); //If widget intersects with sceneRect then mark it as visible item if(visibleArea.isValid()) { addVisibleAreas(newitem->getPageIndex(), visibleArea, newitem->size()); } } }
QLineF CurveTracker::curveLineAt( const QwtPlotCurve *curve, double x ) const { QLineF line; if ( curve->dataSize() >= 2 ) { const QRectF br = curve->boundingRect(); if ( br.isValid() && x >= br.left() && x <= br.right() ) { int index = qwtUpperSampleIndex<QPointF>( *curve->data(), x, compareX() ); if ( index == -1 && x == curve->sample( curve->dataSize() - 1 ).x() ) { // the last sample is excluded from qwtUpperSampleIndex index = curve->dataSize() - 1; } if ( index > 0 ) { line.setP1( curve->sample( index - 1 ) ); line.setP2( curve->sample( index ) ); } } } return line; }
QRectF MapPart::calculateExtent(bool include_helper_symbols) const { QRectF rect; int i = 0; int size = objects.size(); while (size > i && !rect.isValid()) { if ((include_helper_symbols || !objects[i]->getSymbol()->isHelperSymbol()) && !objects[i]->getSymbol()->isHidden()) { objects[i]->update(); rect = objects[i]->getExtent(); } ++i; } for (; i < size; ++i) { if ((include_helper_symbols || !objects[i]->getSymbol()->isHelperSymbol()) && !objects[i]->getSymbol()->isHidden()) { objects[i]->update(); rectInclude(rect, objects[i]->getExtent()); } } return rect; }
void QReportWidgetResizer::handleMoving(QPointF point) { QReportResizeHandle *s = qobject_cast<QReportResizeHandle*> (sender()); QRectF rc = resizeRect; QReportMoveEvent e(point, point); emit pointGridNeeded(&e); if (!e.isAccepted()) return; if (s->resizeDirection() & ::Top) rc.setTop(e.point().y()); if (s->resizeDirection() & ::Left) rc.setLeft(e.point().x()); if (s->resizeDirection() & ::Right) rc.setRight(e.point().x()); if (s->resizeDirection() & ::Bottom) rc.setBottom(e.point().y()); if(_selectedWidgets.count() == 1){ if(rc.width() < _selectedWidgets.at(0)->minimumSize().width()) rc.setWidth(_selectedWidgets.at(0)->minimumSize().width()); if(rc.height() < _selectedWidgets.at(0)->minimumSize().height()) rc.setHeight(_selectedWidgets.at(0)->minimumSize().height()); } if (rc.isValid()) { setResezeHandlePos(s, e.point()); resizeRect = rc; proccessNewRect(rc); setHandlesOnItem(rc); }//if }
QRectF QgsLayout::pageItemBounds( int page, bool visibleOnly ) const { //start with an empty rectangle QRectF bounds; //add all QgsLayoutItems on page const QList<QGraphicsItem *> itemList = items(); for ( QGraphicsItem *item : itemList ) { const QgsLayoutItem *layoutItem = dynamic_cast<const QgsLayoutItem *>( item ); if ( layoutItem && layoutItem->type() != QgsLayoutItemRegistry::LayoutPage && layoutItem->page() == page ) { if ( visibleOnly && !layoutItem->isVisible() ) continue; //expand bounds with current item's bounds if ( bounds.isValid() ) bounds = bounds.united( item->sceneBoundingRect() ); else bounds = item->sceneBoundingRect(); } } return bounds; }
void AbstractGraphicsRectItem::updateRect(const QRectF &rect) { if (!rect.isNull() && rect.isValid()) { setRect(rect); updateHandlesPosition(); } }
QVariant ComplexControlModel::doData(int row, int column, int role) const { if (role == Qt::DecorationRole) { QPixmap pixmap(m_interface->cellSizeHint()); QPainter painter(&pixmap); Util::drawTransparencyPattern(&painter, pixmap.rect()); painter.scale(m_interface->cellZoom(), m_interface->cellZoom()); QScopedPointer<QStyleOptionComplex> opt( qstyleoption_cast<QStyleOptionComplex*>(complexControlElements[row].styleOptionFactory())); Q_ASSERT(opt); fillStyleOption(opt.data(), column); m_style->drawComplexControl(complexControlElements[row].control, opt.data(), &painter); int colorIndex = 7; for (int i = 0; i < 32; ++i) { QStyle::SubControl sc = static_cast<QStyle::SubControl>(1 << i); if (sc & complexControlElements[row].subControls) { QRectF scRect = m_style->subControlRect(complexControlElements[row].control, opt.data(), sc); scRect.adjust(0, 0, -1.0 / m_interface->cellZoom(), -1.0 / m_interface->cellZoom()); if (scRect.isValid() && !scRect.isEmpty()) { // HACK: add some real color mapping painter.setPen(static_cast<Qt::GlobalColor>(colorIndex++)); painter.drawRect(scRect); } } } return pixmap; } return AbstractStyleElementStateTable::doData(row, column, role); }
void RectTool::updateFrameRect() { QRectF rect; if (d->mode == Inserting) { d->frameItem->setVisible(true); rect = d->layerToAdd->rect(); } else { if (!(d->selectedLayerInfos.size() == 1 && d->selectedLayerInfos.at(0).rectLayer->isType<RectLayer>())) { for (const auto &info : d->selectedLayerInfos) { if (info.rectLayer) rect |= info.rectLayer->rect(); else if (info.original->isType<RasterLayer>()) rect |= info.rasterBoundingRect.translated(info.rasterOffset); } } } // set path if (rect.isValid()) { QPainterPath path; path.addRect(rect); d->frameItem->setVisible(true); d->frameItem->setPath(path * canvas()->transforms()->sceneToView); } else d->frameItem->setVisible(false); }
/*! \return Bounding rectangle of all samples. For an empty series the rectangle is invalid. */ QRectF QwtPlotHistogram::boundingRect() const { QRectF rect = d_series->boundingRect(); if ( !rect.isValid() ) return rect; if ( orientation() == Qt::Horizontal ) { rect = QRectF( rect.y(), rect.x(), rect.height(), rect.width() ); if ( rect.left() > d_data->baseline ) rect.setLeft( d_data->baseline ); else if ( rect.right() < d_data->baseline ) rect.setRight( d_data->baseline ); } else { if ( rect.bottom() < d_data->baseline ) rect.setBottom( d_data->baseline ); else if ( rect.top() > d_data->baseline ) rect.setTop( d_data->baseline ); } return rect; }
/*! \return Bounding rectangle of all samples. For an empty series the rectangle is invalid. */ QRectF QwtPlotIntervalCurve::boundingRect() const { QRectF rect = QwtPlotSeriesItem<QwtIntervalSample>::boundingRect(); if ( rect.isValid() && orientation() == Qt::Vertical ) rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() ); return rect; }
void SvgItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.size() != oldGeometry.size() && newGeometry.isValid()) { scheduleImageUpdate(); } QQuickItem::geometryChanged(newGeometry, oldGeometry); }
/*! Draw the SVG item \param painter Painter \param xMap X-Scale Map \param yMap Y-Scale Map \param canvasRect Contents rect of the plot canvas */ void QwtPlotSvgItem::draw( QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect ) const { const QRectF cRect = QwtScaleMap::invTransform( xMap, yMap, canvasRect.toRect() ); const QRectF bRect = boundingRect(); if ( bRect.isValid() && cRect.isValid() ) { QRectF rect = bRect; if ( bRect.contains( cRect ) ) rect = cRect; const QRectF r = QwtScaleMap::transform( xMap, yMap, rect ); render( painter, viewBox( rect ), r ); } }
/*! \brief Render the plot to a given rectangle ( f.e QPrinter, QSvgRenderer ) \param plot Plot widget to be rendered \param painter Painter \param plotRect Bounding rectangle for the plot */ void QwtPolarRenderer::render( QwtPolarPlot *plot, QPainter *painter, const QRectF &plotRect ) const { if ( plot == NULL || painter == NULL || !painter->isActive() || !plotRect.isValid() || plot->size().isNull() ) { return; } d_data->plot = plot; /* The layout engine uses the same methods as they are used by the Qt layout system. Therefore we need to calculate the layout in screen coordinates and paint with a scaled painter. */ QTransform transform; transform.scale( double( painter->device()->logicalDpiX() ) / plot->logicalDpiX(), double( painter->device()->logicalDpiY() ) / plot->logicalDpiY() ); const QRectF layoutRect = transform.inverted().mapRect( plotRect ); QwtPolarLayout *layout = plot->plotLayout(); // All paint operations need to be scaled according to // the paint device metrics. QwtPolarLayout::Options layoutOptions = QwtPolarLayout::IgnoreScrollbars | QwtPolarLayout::IgnoreFrames; layout->activate( plot, layoutRect, layoutOptions ); painter->save(); painter->setWorldTransform( transform, true ); painter->save(); renderTitle( painter, layout->titleRect() ); painter->restore(); painter->save(); renderLegend( painter, layout->legendRect() ); painter->restore(); const QRectF &canvasRect = layout->canvasRect(); painter->save(); painter->setClipRect( canvasRect ); plot->drawCanvas( painter, canvasRect ); painter->restore(); painter->restore(); layout->invalidate(); d_data->plot = NULL; }
void EditorMagnifierItem::paint(QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget * widget) { Q_UNUSED(option); Q_UNUSED(widget); if ( !scene() ) return; QRectF rect = getRect(); EditorScene *scn = qobject_cast<EditorScene *>( scene() ); if (rect.isValid() && m_valid && scn) { updateMask(); painter->save(); // because clipping is active !! QPainterPath clipPath; clipPath.addEllipse(getRect().center(), getRect().width() / 2,getRect().width() / 2); painter->setClipPath(clipPath); painter->setClipping(true); // TODO add extracted image to a cache !!! QRectF extractRect( rect.translated( pos() - scn->getUnderlayOffset() ) ); int extractWidth = extractRect.width() / m_magnifyingFactor; extractRect.adjust(extractWidth,extractWidth,-extractWidth,-extractWidth); QRectF bgRect = scn->getUnderlayImage().rect(); QRectF croppedRect = extractRect.intersected(bgRect); if ( !croppedRect.isNull() ) { QImage background = scn->getUnderlayImage().copy( croppedRect.toRect() ); QImage mag = background.scaled(rect.size().toSize(),Qt::KeepAspectRatio,Qt::SmoothTransformation); painter->drawImage(rect,mag); } painter->drawPixmap(rect.topLeft(), m_imgMask); painter->restore(); } // draw a box if selected if( isSelected() ) { painter->save(); QPen pen; pen.setCosmetic(true); pen.setColor(Qt::black); pen.setWidth(1); pen.setStyle(Qt::DotLine); painter->setPen(pen); painter->drawRect(rect); painter->restore(); } }
static inline Polygon qwtToPoints( const QRectF &boundingRect, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData<QPointF> *series, int from, int to, Round round ) { Polygon polyline( to - from + 1 ); Point *points = polyline.data(); int numPoints = 0; if ( boundingRect.isValid() ) { // iterating over all values // filtering out all points outside of // the bounding rectangle for ( int i = from; i <= to; i++ ) { const QPointF sample = series->sample( i ); const double x = xMap.transform( sample.x() ); const double y = yMap.transform( sample.y() ); if ( boundingRect.contains( x, y ) ) { points[ numPoints ].rx() = round( x ); points[ numPoints ].ry() = round( y ); numPoints++; } } polyline.resize( numPoints ); } else { // simply iterating over all values // without any filtering for ( int i = from; i <= to; i++ ) { const QPointF sample = series->sample( i ); const double x = xMap.transform( sample.x() ); const double y = yMap.transform( sample.y() ); points[ numPoints ].rx() = round( x ); points[ numPoints ].ry() = round( y ); numPoints++; } } return polyline; }
void RenderNodeInstanceServer::findItemChangesAndSendChangeCommands() { static bool inFunction = false; if (!inFunction) { inFunction = true; bool adjustSceneRect = false; if (delcarativeView()) { foreach (QGraphicsItem *item, delcarativeView()->items()) { QGraphicsObject *graphicsObject = item->toGraphicsObject(); if (graphicsObject && hasInstanceForObject(graphicsObject)) { ServerNodeInstance instance = instanceForObject(graphicsObject); QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); if((d->dirty && d->notifyBoundingRectChanged)|| (d->dirty && !d->dirtySceneTransform) || nonInstanceChildIsDirty(graphicsObject)) m_dirtyInstanceSet.insert(instance); if (d->geometryChanged) { if (instance.isRootNodeInstance()) delcarativeView()->scene()->setSceneRect(item->boundingRect()); } } } foreach (const InstancePropertyPair& property, changedPropertyList()) { const ServerNodeInstance instance = property.first; const QString propertyName = property.second; if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height")) adjustSceneRect = true; if (propertyName == "width" || propertyName == "height") m_dirtyInstanceSet.insert(instance); } clearChangedPropertyList(); resetAllItems(); if (!m_dirtyInstanceSet.isEmpty() && nodeInstanceClient()->bytesToWrite() < 10000) { nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(m_dirtyInstanceSet.toList())); m_dirtyInstanceSet.clear(); } if (adjustSceneRect) { QRectF boundingRect = rootNodeInstance().boundingRect(); if (boundingRect.isValid()) { delcarativeView()->setSceneRect(boundingRect); } } slowDownRenderTimer(); nodeInstanceClient()->flush(); nodeInstanceClient()->synchronizeWithClientProcess(); }
void Guideline::rangeOfAttachedObjects(double& min, double& max) const { min = DBL_MAX; max = -DBL_MAX; for (RelsList::const_iterator curr = relationships.begin(); curr != relationships.end(); ++curr) { QRectF itemRect; if ((*curr)->shape) { itemRect = (*curr)->shape->boundingRect(); itemRect.moveCenter((*curr)->shape->pos()); } else if ((*curr)->distro) { itemRect = (*curr)->distro->boundingRect(); itemRect.moveCenter((*curr)->distro->pos()); } else if ((*curr)->separation) { itemRect = (*curr)->separation->boundingRect(); itemRect.moveCenter((*curr)->separation->pos()); } if (itemRect.isValid()) { if (get_dir() == GUIDE_TYPE_HORI) { min = qMin(min, itemRect.left()); max = qMax(max, itemRect.right()); } else { min = qMin(min, itemRect.top()); max = qMax(max, itemRect.bottom()); } } } // Cope with the case where there are no attached objects. if ((min == DBL_MAX) && (max = -DBL_MAX) && canvas()) { QRectF sceneBounds = canvas()->combinedViewsRect(); if (get_dir() == GUIDE_TYPE_HORI) { min = sceneBounds.left(); max = sceneBounds.right(); } else { min = sceneBounds.top(); max = sceneBounds.bottom(); } } }
QRect orReport::backgroundRect() { if(_internal != 0) { QRectF rf = _internal->_prerenderer.backgroundRect(); if(rf.isValid()) return QRect((int)(rf.x() * 100), (int)(rf.y() * 100), (int)(rf.width() * 100), (int)(rf.height() * 100)); } return QRect(); }
int RotateTool::updateDirtyRectImpl(QRectF& rect) { if (rotation_center_set) { rectIncludeSafe(rect, rotation_center); return qMax(angle_helper->getDisplayRadius(), 5); } else return rect.isValid() ? 0 : -1; }
void QQuickContext2DImageTexture::grabImage(const QRectF& rf) { Q_ASSERT(rf.isValid()); QQuickContext2D::mutex.lock(); if (m_context) { QImage grabbed = m_displayImage.copy(rf.toRect()); m_context->setGrabbedImage(grabbed); } QQuickContext2D::mutex.unlock(); }
QRectF TiledListView::viewportRectForRow(int row) const { calculateRectsIfNecessary(); QRectF rect = rectForRow.value(row).toRect(); if (!rect.isValid()) return rect; return QRectF(rect.x() - horizontalScrollBar()->value(), rect.y() - verticalScrollBar()->value(), rect.width(), rect.height()); }
QRectF QgsLayout::layoutBounds( bool ignorePages, double margin ) const { //start with an empty rectangle QRectF bounds; //add all layout items and pages which are in the layout Q_FOREACH ( const QGraphicsItem *item, items() ) { const QgsLayoutItem *layoutItem = dynamic_cast<const QgsLayoutItem *>( item ); if ( !layoutItem ) continue; bool isPage = layoutItem->type() == QgsLayoutItemRegistry::LayoutPage; if ( !isPage || !ignorePages ) { //expand bounds with current item's bounds QRectF itemBounds; if ( isPage ) { // for pages we only consider the item's rect - not the bounding rect // as the bounding rect contains extra padding itemBounds = layoutItem->mapToScene( layoutItem->rect() ).boundingRect(); } else itemBounds = item->sceneBoundingRect(); if ( bounds.isValid() ) bounds = bounds.united( itemBounds ); else bounds = itemBounds; } } if ( bounds.isValid() && margin > 0.0 ) { //finally, expand bounds out by specified margin of page size double maxWidth = mPageCollection->maximumPageWidth(); bounds.adjust( -maxWidth * margin, -maxWidth * margin, maxWidth * margin, maxWidth * margin ); } return bounds; }
void BlurItem::reload(const QPixmap &pixmap) { const QRectF r = rect(); if (r.isNull() && !r.isValid()) return; QTransform t = sceneTransform(); t.translate(qAbs(scene()->sceneRect().left()), qAbs(scene()->sceneRect().top())); m_item->setPixmap(pixmap.copy(t.mapRect(r).toRect())); }
void NodeElement::setGeometry(const QRectF &geom) { prepareGeometryChange(); setPos(geom.topLeft()); if (geom.isValid()) { mContents = geom.translated(-geom.topLeft()); } mTransform.reset(); mTransform.scale(mContents.width(), mContents.height()); adjustLinks(); }