onMousePressEvent callback of ccGLWindow has delay

Feel free to ask any question here
Post Reply
hzycaicai
Posts: 2
Joined: Wed Mar 13, 2019 12:50 pm

onMousePressEvent callback of ccGLWindow has delay

Post 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?
daniel
Site Admin
Posts: 7472
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: onMousePressEvent callback of ccGLWindow has delay

Post 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).
Daniel, CloudCompare admin
Post Reply