Hi,

I am using QGraphicsView for my application. I allow panning on ctrl+mousemove event. And when I release ctrl key, the view's drag mode is set to NoScroll. But in this case also when I press left mouse button , the mouse icon is changed to Qt::OpenHandCursor, which usually comes if the view allows panning.

Does any one know how to deal with this issue.
Below is the code snippet

Qt Code:
  1. void MyGraphicsView::keyReleaseEvent(QKeyEvent* event)
  2. {
  3. if (event->key()==Qt::Key_Control)
  4. {
  5. m_DragMode=NO_DRAG;
  6. setDragMode(QGraphicsView::NoDrag);
  7. }
  8. }
  9.  
  10. void MyGraphicsView::keyPressEvent(QKeyEvent* event)
  11. {
  12. //ctrl key is pressed
  13. if (event->key()==Qt::Key_Control)
  14. {
  15. m_DragMode=SCROLL_HANDLE_DRAG;
  16. setDragMode(QGraphicsView::ScrollHandDrag);
  17. }
  18. }
To copy to clipboard, switch view to plain text mode