Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE] Allow multi item drag and resize in composer (fix #7918)
[FEATURE] Always draw selection handles on top of composition, add dashed border for selected items (fix #7793)
Move responsibility for drawing selection mouse handles and mouse interaction with selection to new class
  • Loading branch information
nyalldawson authored and mhugent committed Oct 2, 2013
1 parent 7bc72d4 commit 24d1106
Show file tree
Hide file tree
Showing 10 changed files with 1,133 additions and 702 deletions.
20 changes: 0 additions & 20 deletions python/core/composer/qgscomposeritem.sip
Expand Up @@ -332,10 +332,6 @@ class QgsComposerItem: QObject, QGraphicsRectItem
@note this method was added in version 1.2*/
bool positionLock() const;

/**Update mouse cursor at (item) position
@note this method was added in version 1.2*/
void updateCursor( const QPointF& itemPos );

double rotation() const;

/**Updates item, with the possibility to do custom update for subclasses*/
Expand Down Expand Up @@ -367,22 +363,6 @@ class QgsComposerItem: QObject, QGraphicsRectItem

virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event );

/**Finds out the appropriate cursor for the current mouse position in the widget (e.g. move in the middle, resize at border)*/
Qt::CursorShape cursorForPosition( const QPointF& itemCoordPos );

/**Finds out which mouse move action to choose depending on the cursor position inside the widget*/
QgsComposerItem::MouseMoveAction mouseMoveActionForPosition( const QPointF& itemCoordPos );

/**Changes the rectangle of an item depending on current mouse action (resize or move)
@param currentPosition current position of mouse cursor
@param mouseMoveStartPos cursor position at the start of the current mouse action
@param originalItem Item position at the start of the mouse action
@param dx x-Change of mouse cursor
@param dy y-Change of mouse cursor
@param changeItem Item to change size (can be the same as originalItem or a differen one)
*/
void changeItemRectangle( const QPointF& currentPosition, const QPointF& mouseMoveStartPos, const QGraphicsRectItem* originalItem, double dx, double dy, QGraphicsRectItem* changeItem );

/**Draw selection boxes around item*/
virtual void drawSelectionBoxes( QPainter* p );

Expand Down
17 changes: 0 additions & 17 deletions python/core/composer/qgscomposition.sip
Expand Up @@ -213,23 +213,6 @@ class QgsComposition : QGraphicsScene
/**Snaps a scene coordinate point to grid*/
QPointF snapPointToGrid( const QPointF& scenePoint ) const;

/**Snaps item position to align with other items (left / middle / right or top / middle / bottom
@param item current item
@param alignX x-coordinate of align or -1 if not aligned to x
@param alignY y-coordinate of align or -1 if not aligned to y
@param dx item shift in x direction
@param dy item shift in y direction
@return new upper left point after the align*/
QPointF alignItem( const QgsComposerItem* item, double& alignX, double& alignY, double dx = 0, double dy = 0 );

/**Snaps position to align with the boundaries of other items
@param pos position to snap
@param excludeItem item to exclude
@param alignX snapped x coordinate or -1 if not snapped
@param alignY snapped y coordinate or -1 if not snapped
@return snapped position or original position if no snap*/
QPointF alignPos( const QPointF& pos, const QgsComposerItem* excludeItem, double& alignX, double& alignY );

/**Add a custom snap line (can be horizontal or vertical)*/
QGraphicsLineItem* addSnapLine();
/**Remove custom snap line (and delete the object)*/
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -133,6 +133,7 @@ SET(QGIS_CORE_SRCS
composer/qgscomposermultiframecommand.cpp
composer/qgscomposerarrow.cpp
composer/qgscomposerframe.cpp
composer/qgscomposermousehandles.cpp
composer/qgscomposeritem.cpp
composer/qgscomposeritemcommand.cpp
composer/qgscomposeritemgroup.cpp
Expand Down Expand Up @@ -324,6 +325,7 @@ SET(QGIS_CORE_MOC_HDRS
composer/qgscomposerscalebar.h
composer/qgscomposeritem.h
composer/qgscomposeritemgroup.h
composer/qgscomposermousehandles.h
composer/qgscomposerlabel.h
composer/qgscomposershape.h
composer/qgscomposerattributetable.h
Expand Down

0 comments on commit 24d1106

Please sign in to comment.