It is a whole day, that i try to resolve this problem.

In a few words:

I have myscene class (custom QGraphicsScene), myview class(custom QGraphicsView) and myrect(custom QgraphicsRectItem).........

I insert myrect into myscene and i can move and select it without any problem.
Now i'm trying to implement the resize behaviour of myrect.

so, i introduce in my implementation a variabile of type enum that set the modality of my scene(enum type{MoveItem,Resizing}...for example.....
i also have a variable(enum type_resize) in myrect class, that set the kind of resize(NO_RESIZE, horizzontal, vertical, .......)

my example code:

myscene.class
Qt Code:
  1. mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent){
  2.  
  3. ((rectItem*)(mouseEvent->widget()))->set_resize_type(rectItem::vertical);
  4. setMode(Resizing);
  5.  
  6. QGraphicsScene::mousePressEvent(mouseEvent);
  7. }
  8.  
  9. mouseMoveEvent( QGraphicsSceneMouseEvent *event ) {
  10. QGraphicsScene::mouseMoveEvent(event);
  11. }
To copy to clipboard, switch view to plain text mode 

myrect.class
Qt Code:
  1. mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent){
  2. if(myscene::Resizing)
  3. QGraphicsRectItem::mousePressEvent(mouseEvent);
  4. }
  5. mouseMoveEvent(QGraphicsSceneMouseEvent *event){
  6. if(myscene::Resizing)
  7. //execute the right resizing, depending on the value of type_resize
  8. ?????????????????????????????????????????
  9. Here the problem.....Why the variable type_resize(enum) has always the value of 0(the first value of the enum-->NO_RESIZE???)???????
  10. A wrote some printf for debugging, and i saw that 1 step before the type_resize has the "right" value, but when i print it in the mouseMoveEvent of myrect it change it's value.......Who change this value??Perhaps some spirit.....
  11. }
To copy to clipboard, switch view to plain text mode