Hi, I'm trying to solve a problem I was postponing during too much time and now I'm out of ideas.

I have a subclassed QGraphicsTextItem that only receives the drag and drop event when "mousePressEvent" is not implemented. Everything, everything works perfectly (edit text, change the font...) but drag&drop.

Qt Code:
  1. #pragma once
  2. #ifndef ITEXTOITEM_H
  3. #define ITEXTOITEM_H
  4.  
  5. #include "Common/TextoItem.h"
  6. #include <QMenu>
  7.  
  8. class CITextoItem : public CTextoItem //CTextoItem inherits from QGraphicsTextItem
  9. {
  10. Q_OBJECT
  11.  
  12. public:
  13. CITextoItem();
  14. ~CITextoItem();
  15.  
  16. private:
  17. void mousePressEvent(QGraphicsSceneMouseEvent *event);
  18.  
  19. QMenu* m_pMenu;
  20.  
  21. private slots:
  22. void menuClicked(QAction* pAction);
  23. };
  24.  
  25. #endif //ITEXTOITEM
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. void CITextoItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
  2. {//it should work...
  3. QGraphicsItem::mousePressEvent(event);
  4. }
To copy to clipboard, switch view to plain text mode 


just in case, the father's class
Qt Code:
  1. #pragma once
  2. #ifndef TEXTOITEM_H
  3. #define TEXTOITEM_H
  4.  
  5. #include "FormElemItem.h"
  6. #include <QGraphicsTextItem>
  7. #include <QObject>
  8.  
  9. class CTextoItem : public QGraphicsTextItem
  10. {
  11. Q_OBJECT
  12.  
  13. public:
  14. enum { Type = UserType + 5 };
  15. int type() const
  16. {
  17. // Enable the use of qgraphicsitem_cast with this item.
  18. return Type;
  19. }
  20.  
  21. CTextoItem();
  22. ~CTextoItem();
  23. };
  24.  
  25. #endif //TEXTOITEM_H
To copy to clipboard, switch view to plain text mode 

It doesn't mind the code I have inside the mousePressEvent function, drag&drop doesn't work if the function is implemented and it works perfectly if I remove it.

Do you have any clue? right now, I'm out of ideas.

thanks!