Re: mousePressEvent problem
How do you know it is not being called?
Put a break point on the first line and see if it gets caught, may be( FLOATING_DOT == mouseMode ) is false.
Re: mousePressEvent problem
Or replace mouseMoveEvent and mousePressEvent..I mean get the pressEvent just top of the moveEvent and try..
Re: mousePressEvent problem
Quote:
Originally Posted by
high_flyer
How do you know it is not being called?
Put a break point on the first line and see if it gets caught, may be( FLOATING_DOT == mouseMode ) is false.
This is how I know it is not being called--I have done just what you suggested
Re: mousePressEvent problem
not sure what you mean by this. Are you saying to re-order the functions? Why would that matter?
Re: mousePressEvent problem
Quote:
Originally Posted by
zgulser
Or replace mouseMoveEvent and mousePressEvent..I mean get the pressEvent just top of the moveEvent and try..
not sure what you mean by this. Are you saying to re-order the functions? Why would that matter?
ps: sorry about the unquoted reply that probably didn't make much sense with no context, it's early in the workday...
Re: mousePressEvent problem
Quote:
Are you saying to re-order the functions?
Exactly..Once I've faced with such a problem. And after I replace the regarding functions, it was OK.
Re: mousePressEvent problem
I was having what sounds like a similar problem recently where a custom QWidget (comprising QPushButton and QSpinBox) was being added to a QMenu as a QWidgetAction. I wanted a click (or mouseReleaseEvent) from the QPushButton to "activate" the QActionWidget.
I had to do a little work to get the mouseReleaseEvent to propagate through to the QMenu (using this post). I managed to catch execution in QMenu::activate, but d->mouseDown was not set. I think it had to do with clicking on the QPushButton which was not being considered to be "inside" the QWidgetAction and therefore failing to actually properly activate the QWidgetAction. This is the thread.
I solved my problem with a simple workaround, but would like to get it working using events properly.
EDIT: I just had a look at your code snippet again. I think you might need to call mousePressEvent on your base class in void ImageGLView::mousePressEvent(QMouseEvent *event).
i.e.
Code:
{
if(FLOATING_DOT == mouseMode){
QPoint currentPos
= event
->pos
();
lastPos = currentPos;
}
QBaseClass::mousePressEvent(event);
}
EDIT: I take it back - I reread you post and I realised that your mousePressEvent isn't even being called. Is the base class mousePressEvent being called when clicking inside QGLWidget (unlikely)? Is the parent's mousePressEvent being called when you click inside the QGLWidget (should happen under normal circumstances, as far as I understand)?
Re: mousePressEvent problem
Quote:
Originally Posted by
stefanadelbert
I was having what sounds like a similar problem recently where a custom QWidget (comprising QPushButton and QSpinBox) was being added to a QMenu as a QWidgetAction. I wanted a click (or mouseReleaseEvent) from the QPushButton to "activate" the QActionWidget.
I had to do a little work to get the mouseReleaseEvent to propagate through to the QMenu (using
this post). I managed to catch execution in QMenu::activate, but d->mouseDown was not set. I think it had to do with clicking on the QPushButton which was not being considered to be "inside" the QWidgetAction and therefore failing to actually properly activate the QWidgetAction. This is the
thread.
I solved my problem with a simple workaround, but would like to get it working using events properly.
EDIT: I just had a look at your code snippet again. I
think you might need to call mousePressEvent on your base class in void ImageGLView::mousePressEvent(QMouseEvent *event).
i.e.
Code:
{
if(FLOATING_DOT == mouseMode){
QPoint currentPos
= event
->pos
();
lastPos = currentPos;
}
QBaseClass::mousePressEvent(event);
}
EDIT: I take it back - I reread you post and I realised that your mousePressEvent isn't even being called. Is the base class mousePressEvent being called when clicking inside QGLWidget (unlikely)? Is the parent's mousePressEvent being called when you click inside the QGLWidget (should happen under normal circumstances, as far as I understand)?
no, the base class mousePressEvent is NOT being called,or does it appear that the parents mousePressEvent is being called
Re: mousePressEvent problem
The parent's mousePressEvent should get called, unless the event is not being passed up for some reason.
Maybe try reimplementing mouseReleaseEvent in QGLWidget and see if that is called.