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?
test1.jpg
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);
layout->addWidget(m_view,0,0,-1,-1);
layout->addWidget(m_textOut,1,0);
layout->addWidget(m_textOut2,1,1);
setLayout(layout);
m_view= new saView(0);
m_textOut= new QLabel();
m_textOut2=new QLabel();
QGridLayout *layout = new QGridLayout;
layout->addWidget(m_view,0,0,-1,-1);
layout->addWidget(m_textOut,1,0);
layout->addWidget(m_textOut2,1,1);
setLayout(layout);
To copy to clipboard, switch view to plain text mode
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.
Bookmarks