Implemented a primitive decorator, allowing groups of primitives to be easily resized.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2027 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2013-02-08 22:05:15 +00:00
parent 73fa01c7b9
commit 2bed00fd25
21 changed files with 1566 additions and 124 deletions

View File

@@ -44,6 +44,61 @@ QUndoStack &CustomElementPart::undoStack() const {
return(elementScene() -> undoStack());
}
/// @return this primitive as a QGraphicsItem
QGraphicsItem *CustomElementPart::toItem() {
return(dynamic_cast<QGraphicsItem *>(this));
}
/**
This method is called by the decorator when it manages only a single
primitive. This brings the possibility to implement custom behaviour, such
as text edition, points edition or specific resizing.
The default implementation does nothing.
*/
void CustomElementPart::setDecorator(ElementPrimitiveDecorator *decorator) {
Q_UNUSED(decorator)
}
/**
This method is called by the decorator when it manages only a single
primitive and it received a mouse press event.
The implementation should return true if the primitive accepts the event, false otherwise.
The default implementation returns false.
*/
bool CustomElementPart::singleItemPressEvent(ElementPrimitiveDecorator *, QGraphicsSceneMouseEvent *) {
return(false);
}
/**
This method is called by the decorator when it manages only a single
primitive and it received a mouse move event.
The implementation should return true if the primitive accepts the event, false otherwise.
The default implementation returns false.
*/
bool CustomElementPart::singleItemMoveEvent(ElementPrimitiveDecorator *, QGraphicsSceneMouseEvent *) {
return(false);
}
/**
This method is called by the decorator when it manages only a single
primitive and it received a mouse release event.
The implementation should return true if the primitive accepts the event, false otherwise.
The default implementation returns false.
*/
bool CustomElementPart::singleItemReleaseEvent(ElementPrimitiveDecorator *, QGraphicsSceneMouseEvent *) {
return(false);
}
/**
This method is called by the decorator when it manages only a single
primitive and it received a mouse double click event.
The implementation should return true if the primitive accepts the event, false otherwise.
The default implementation returns false.
*/
bool CustomElementPart::singleItemDoubleClickEvent(ElementPrimitiveDecorator *, QGraphicsSceneMouseEvent *) {
return(false);
}
/**
Helper method to map points in CustomElementPart::handleUserTransformation()
@param initial_selection_rect Selection rectangle when the movement started, in scene coordinates