Commit 348e440e authored by Thomas Zander's avatar Thomas Zander

replace KoShape::boundingBox with KoShape::boundingRect

svn path=/trunk/koffice/; revision=544820
parent febb7675
......@@ -84,7 +84,7 @@ void KoInteractionTool::paint( QPainter &painter, KoViewConverter &converter) {
painter.setPen( pen );
bool editable=false;
foreach(KoShape *shape, selection()->selectedObjects(KoFlake::StrippedSelection)) {
painter.drawRect( converter.normalToView(shape->boundingBox()) );
painter.drawRect( converter.normalToView(shape->boundingRect()) );
if(!shape->isLocked())
editable = true;
}
......@@ -92,7 +92,7 @@ void KoInteractionTool::paint( QPainter &painter, KoViewConverter &converter) {
if( !editable)
return;
SelectionDecorator decorator(selection()->boundingBox(), m_lastHandle, true, true);
SelectionDecorator decorator(selection()->boundingRect(), m_lastHandle, true, true);
decorator.paint(painter, converter);
}
}
......@@ -125,7 +125,7 @@ void KoInteractionTool::mouseMoveEvent( KoGfxEvent *event ) {
}
QRectF KoInteractionTool::handlesSize() {
QRectF bound = selection()->boundingBox();
QRectF bound = selection()->boundingRect();
// expansion Border
QPointF border = m_canvas->viewConverter()->viewToNormal(QPointF(HANDLE_DISTANCE, HANDLE_DISTANCE));
bound.adjust(-border.x(), -border.y(), border.x(), border.y());
......@@ -207,7 +207,7 @@ KoFlake::SelectionHandle KoInteractionTool::handleAt(const QPointF &point, bool
}
void KoInteractionTool::recalcSelectionBox() {
QRectF bb( selection()->boundingBox() );
QRectF bb( selection()->boundingRect() );
float width = bb.width();
float height = bb.height();
float halfWidth = width / 2.0;
......
......@@ -86,7 +86,7 @@ bool KoPathShape::hitTest( const QPointF &position ) const
return m_path.contains( point );
}
QRectF KoPathShape::boundingBox() const
QRectF KoPathShape::boundingRect() const
{
QRectF bb( m_path.boundingRect() );
bb.moveTopLeft( position() );
......
......@@ -43,7 +43,7 @@ public:
void close();
bool hitTest( const QPointF &position ) const;
virtual QRectF boundingBox() const;
virtual QRectF boundingRect() const;
virtual const QPainterPath outline() const;
private:
......
......@@ -42,7 +42,7 @@ void KoSelection::paint( QPainter &painter, KoViewConverter &converter)
if ( count() == 0 )
return;
painter.setRenderHint( QPainter::Antialiasing, false );
QRectF bb = converter.normalToView( boundingBox() );
QRectF bb = converter.normalToView( boundingRect() );
QPen pen( Qt::blue ); //TODO make it configurable
painter.setPen( pen );
painter.drawRect( bb );
......@@ -97,7 +97,7 @@ void KoSelection::requestSelectionChangedEvent() {
void KoSelection::selectionChangedEvent() {
m_eventTriggered = false;
QRectF bb( boundingBox() );
QRectF bb( boundingRect() );
resize( bb.size() );
setPosition( bb.topLeft() );
emit selectionChanged();
......@@ -112,7 +112,7 @@ bool KoSelection::hitTest( const QPointF &position ) const
{
if ( count() > 1 )
{
QRectF bb( boundingBox() );
QRectF bb( boundingRect() );
return bb.contains( position );
}
else if ( count() == 1 )
......@@ -121,7 +121,7 @@ bool KoSelection::hitTest( const QPointF &position ) const
return false;
}
QRectF KoSelection::boundingBox() const
QRectF KoSelection::boundingRect() const
{
bool first=true;
QRectF bb;
......@@ -132,11 +132,11 @@ QRectF KoSelection::boundingBox() const
if( dynamic_cast<KoShapeGroup*>( *it ))
continue;
if(first) {
bb = (*it)->boundingBox();
bb = (*it)->boundingRect();
first = false;
}
else
bb = bb.unite( ( *it )->boundingBox() );
bb = bb.unite( ( *it )->boundingRect() );
}
}
return bb;
......
......@@ -74,7 +74,7 @@ public:
virtual bool hitTest( const QPointF &position ) const;
virtual QRectF boundingBox() const;
virtual QRectF boundingRect() const;
signals:
/// emitted when the selection is changed
......
......@@ -131,7 +131,7 @@ bool KoShape::hitTest( const QPointF &position ) const
return hit;
}
QRectF KoShape::boundingBox() const
QRectF KoShape::boundingRect() const
{
QRectF bb( QPointF(0, 0), m_size );
return m_matrix.mapRect( bb );
......
......@@ -180,7 +180,7 @@ public:
*
* @return the bounding box of the shape
*/
virtual QRectF boundingBox() const;
virtual QRectF boundingRect() const;
/**
* @brief Add a connector point to the shape
......
......@@ -85,7 +85,7 @@ void KoShapeManager::paint( QPainter &painter, KoViewConverter &converter, bool
if(shape->parent() != 0 && shape->parent()->childClipped(shape))
continue;
if(painter.hasClipping()) {
QRectF objectBox = shape->boundingBox();
QRectF objectBox = shape->boundingRect();
objectBox = converter.normalToView(objectBox);
QRegion objectRegion = QRegion(objectBox.toRect());
......
......@@ -38,16 +38,16 @@ KoShapeMoveStrategy::KoShapeMoveStrategy( KoTool *tool, KoCanvasBase *canvas, co
, m_start(clicked)
{
KoSelectionSet selectedObjects = canvas->shapeManager()->selection()->selectedObjects(KoFlake::StrippedSelection);
QRectF boundingBox;
QRectF boundingRect;
foreach(KoShape *shape, selectedObjects) {
if(shape->isLocked())
continue;
m_selectedObjects << shape;
m_previousPositions << shape->position();
m_newPositions << shape->position();
boundingBox = boundingBox.unite( shape->boundingBox() );
boundingRect = boundingRect.unite( shape->boundingRect() );
}
m_initialTopLeft = boundingBox.topLeft();
m_initialTopLeft = boundingRect.topLeft();
}
void KoShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers) {
......
......@@ -35,7 +35,7 @@ KoShapeResizeStrategy::KoShapeResizeStrategy( KoTool *tool, KoCanvasBase *canvas
m_selectedObjects << shape;
m_startPositions << shape->absolutePosition();
m_startSizes << shape->size();
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingBox() );
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingRect() );
}
m_start = clicked;
......@@ -146,6 +146,6 @@ KCommand* KoShapeResizeStrategy::createCommand() {
}
void KoShapeResizeStrategy::paint( QPainter &painter, KoViewConverter &converter) {
SelectionDecorator decorator (m_canvas->shapeManager()->selection()->boundingBox(), KoFlake::NoHandle, false, false);
SelectionDecorator decorator (m_canvas->shapeManager()->selection()->boundingRect(), KoFlake::NoHandle, false, false);
decorator.paint(painter, converter);
}
......@@ -41,7 +41,7 @@ KoShapeRotateStrategy::KoShapeRotateStrategy( KoTool *tool, KoCanvasBase *canvas
m_selectedObjects << shape;
m_startPositions << shape->absolutePosition();
m_initialAngles << shape->rotation();
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingBox() );
m_initialBoundingRect = m_initialBoundingRect.unite( shape->boundingRect() );
}
}
......@@ -76,7 +76,7 @@ void KoShapeRotateStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMo
}
void KoShapeRotateStrategy::paint( QPainter &painter, KoViewConverter &converter) {
SelectionDecorator decorator (m_canvas->shapeManager()->selection()->boundingBox(), KoFlake::NoHandle, true, false);
SelectionDecorator decorator (m_canvas->shapeManager()->selection()->boundingRect(), KoFlake::NoHandle, true, false);
decorator.paint(painter, converter);
}
......
......@@ -91,8 +91,8 @@ void KoShapeRubberSelectStrategy::finishInteraction()
const QList<KoShape *> &objects = m_canvas->shapeManager()->objects();
foreach ( KoShape * object, objects )
{
//qDebug() << "o bb:" << object->boundingBox() << ", m_selectRect:" << m_selectRect;
if ( object->boundingBox().intersects( m_selectRect ) )
//qDebug() << "o bb:" << object->boundingRect() << ", m_selectRect:" << m_selectRect;
if ( object->boundingRect().intersects( m_selectRect ) )
{
selection->select( object );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment