View Full Version : mouseMoveEvent in QGraphicsView/QGraphicsScene triggers only on a part of the view

3rd July 2014, 10:24
I am really frustrated with this.

I implemented a QGraphicsScene/QGraphicsView with no items at this time.
I use mouse* events to pan/zoom the view in QGraphicsView, and I want to use mouse* events in QGraphicsScene to add objects and manipulate them in the future.
I use drawBackground for a grid in the view and drawForeground for a tiny tooltip-like window that moves along with the mouse cursor in the view.
setMouseTracking on the viewport() is true.

All work fine as I thought, except mouseMoveEvents are triggered only on the upper 3/4 of the view. The estimation of 3/4 is approximate.
The circled red area is where the mouseMoveEvent is triggered all the time. The little red dots show some points where the mouseMoveEvent is triggered from time to time.

Any first ideas before posting any code?


Added after 1 58 minutes:

Found the problem, although I don't know why it happens.

I was creating my main gui with the following:

m_view= new saView(0);
m_textOut= new QLabel();
m_textOut2=new QLabel();
QGridLayout *layout = new QGridLayout;

removing the two "-1" as layout->addWidget(m_view,0,0); and the problem disappeared!
I can understand why it is related, because I checked the viewport() values of m_view and it seemed right.