PDA

View Full Version : QGraphcisView issue with mouse cursor image



dpatel
20th July 2010, 07:28
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



void MyGraphicsView::keyReleaseEvent(QKeyEvent* event)
{
if (event->key()==Qt::Key_Control)
{
m_DragMode=NO_DRAG;
setDragMode(QGraphicsView::NoDrag);
}
}

void MyGraphicsView::keyPressEvent(QKeyEvent* event)
{
//ctrl key is pressed
if (event->key()==Qt::Key_Control)
{
m_DragMode=SCROLL_HANDLE_DRAG;
setDragMode(QGraphicsView::ScrollHandDrag);
}
}