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