mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-26 13:20:52 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user