PDA

View Full Version : Points selection



CCTeam
7th June 2010, 10:20
Hi all,
I need a suggestion about the better tecnique to perform a points selection: I implemented an OpenGL viewer that is composed of a QMainWindow that contains (in a cental widget) a QGLWidget. All works fine but I have a doubt about the implementation of points selection.
What I want to do is this: when a point selection is requires the main application (QMainWindow) signal to the QGLWidget the needing for a point selection and then it waits untill the point is selected in the QGLWidget (or ESC is pressed). When the point is selected in the QGLWidget it can be returned to the QMainWindow and then the QMainWindow can cotinue to use the point to do something.
The problem is that if the QMainWindow stops to wait for the QGLWidget reasponse, pratically the requirement for points selection never arrive to the QGLWidget and so the software enters in loop.
Does anyone have experience in it? What is the best solution? Thank you very much.

tbscope
7th June 2010, 14:22
You are thinking synchronously while you need to think asynchronously.
Your main application should NEVER wait on something. Yet, it should offer functionality for other processes to signal the main application that something is done.

Hence, try signals and slots.