Page 1 of 1

onMousePressEvent callback of ccGLWindow has delay

Posted: Wed Apr 10, 2019 8:22 am
by hzycaicai
Hi everyone,
I used cloudcompare for research recently, and I have a problem.

I want to implement a function just like drawing rectangle on ccGLWindow, just like this:
Image

Then, I connect the onMousePressEvent and onMouseMoveEvent of ccGLWindow in my own Qt Plugin, just like this:

Code: Select all

connect(glwindow, SIGNAL(leftButtonClicked(int, int)),
        this, SLOT(left_button_clicked(int, int)));
connect(glwindow, SIGNAL(rightButtonClicked(int, int)),
        this, SLOT(right_button_clicked(int, int)));
connect(glwindow, SIGNAL(mouseMoved(int, int, Qt::MouseButtons)),
        this, SLOT(mouse_moved(int, int, Qt::MouseButtons)));
Signal leftButtonClicked is emitted in onMousePressEvent callback of ccGLWindow

Functions left_button_clicked, right_button_clicked, mouse_moved are all slots I implemented to draw a rectangle.

But the problem occurs, the call of left_button_clicked has a delay.

I print log everywhere, and I found when I click the mouse left button, about 1~2s later, onMousePressEvent of ccGLWindow is called, and then my slot is called.

It seems that the QEvent is too much to be processed and then it is processed later?Did anyone else have the same problem?

Re: onMousePressEvent callback of ccGLWindow has delay

Posted: Wed Apr 10, 2019 5:28 pm
by daniel
This seems to be huge... Are you working in debug mode maybe? (but still, that's huge!).

You can try otherwise to make the connection 'direct' (Qt::DirectConnection) and not delayed as it may be by default (not sure).