Results 1 to 8 of 8

Thread: keyevent/zoom

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    33
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default keyevent/zoom

    hi,
    i have written code in keypressevent like below
    Qt Code:
    1. void GLWidget::KeyPressEvent(QKeyEvent *event)
    2. {
    3. switch(event->key())
    4. {
    5. case Qt::Key_Home :
    6.  
    7. sBoundingBox.fMinX=-180;
    8. sBoundingBox.fMinY=-90;
    9. sBoundingBox.fMaxX=+180;
    10. sBoundingBox.fMaxY=+90;
    11.  
    12. break;
    13. case Qt::Key_Plus :
    14.  
    15. sBoundingBox.fMinX += 1000.0;
    16. sBoundingBox.fMaxX -= 1000.0;
    17. sBoundingBox.fMinY += 1000.0;
    18. sBoundingBox.fMaxY -= 1000.0;
    19.  
    20. break;
    21. case Qt::Key_Minus :
    22. sBoundingBox.fMinX -= 1000.0;
    23. sBoundingBox.fMaxX += 1000.0;
    24. sBoundingBox.fMinY -= 1000.0;
    25. sBoundingBox.fMaxY += 1000.0;
    26.  
    27. break;
    28. }
    29. glMatrixMode (GL_PROJECTION);
    30. glLoadIdentity ();
    31.  
    32. glOrtho(sBoundingBox.fMinX, sBoundingBox.fMaxX,sBoundingBox.fMinY,sBoundingBox.fMaxY,-1,1);
    33. glMatrixMode(GL_MODELVIEW);
    34. //glIdleFunc(paintGL);
    35. paintGL();
    36. }
    To copy to clipboard, switch view to plain text mode 
    but program is not enterint at all into this fuction
    can anyone help me?
    thanks and regards
    k. bhogasena reddy
    Last edited by jpn; 23rd January 2009 at 12:13. Reason: missing [code] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.