title: how to display pixel coordinates in mousepressEvent() function and then how to use them in paintGL() function everytime the mouse is clicked
body: <p>I am creating a gui on opengl in qt4 IDE.I have created an widget with opengl window and there I became able to display the [b]curves[/b]. Here I use [b]paintGL()[/b] and within this I call my Drawing function for display.But my problem is that, I here use the[b] mousePressEvent(QMouseEvent *event)[/b] for getting the pixel coordinates so that clicking on the opengl window I can generate the curve at that particular clicking position. but after running the program I found that the initial drawing function and the curve generated. but after clicking the window could not be updated, but in the console application all calculations executed, only the display is not updated.</p>
  
  <p>So how can I update the opengl window after clicking mouse on this window?</p>
  
  <p>Here is my source code:</p>
  
  <p>GlWidget.cpp</p>
  
  <pre><code>//////Mouse Click Event for finding the pixel values//////
  void GLWidget::mousePressEvent(QMouseEvent *event)
  {
  
    float window_width,window_height;
    float ratio_x,ratio_y,cy;  
    click_x=event-&gt;x();
    click_y=event-&gt;y();
    //  qDebug()&lt;&lt;"screen cx1==="&lt;&lt;cx1;
    // qDebug()&lt;&lt;"screen cy1==="&lt;&lt;cy1;
  
    window_width = 800;
    window_height = 600;
  
    ratio_x=30.0/window_width;
    ratio_y=30.0/window_height;
    cy=window_height-click_y;
    click_x=click_x*ratio_x-10;
    click_y=cy*ratio_y-10;
  
    qDebug()&lt;&lt;"original_position_on_screen x==="&lt;&lt;click_x;
    qDebug()&lt;&lt;"original_position_on_screen y==="&lt;&lt;click_y;
  
    count=count+1;
    qDebug()&lt;&lt;"count==="&lt;&lt;count;
    func();                                             
  }
  
  void GLWidget::func()
  {
      Draw_Curve();       //Drawing function
  }
  
  void GLWidget::Draw_Curve()
  {
  //Draw The Curve
  }
  
  
  
  void GLWidget:: paintGL()  // paintGL() function
  {
    glClear(GL_COLOR_BUFFER_BIT);
    Draw_Axes();  //Draw 3d coordinate axes           
  
    func();       //in this function we get the pixel coordinates everytime the    mouse is clicked   in the window
   }
  </code></pre>