Results 1 to 3 of 3

Thread: QKeyEvent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QKeyEvent

    Hi..
    I would Like to use the keybord to generate events on my application ..but I still don't know how to use the QKeyEvent..
    The idea is To zoom (translate ... ) on a View ( QGraphicsView) everytime we press on the Key (Up,Down,Right,Left) ..So I tried to create a methode for that Using QkeyEvent :

    Qt Code:
    1. void myview::keyPressEvent(QKeyEvent *e){
    2. switch(e->key()){
    3. case Qt::Key_Left :
    4. graphicsView->scale(1.2,1.2);
    5. break;
    6. case Qt::Key_Down :
    7. graphicsView->scale(1/1.2,1/1.2);
    8. break;
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    but it dosnt work ( nothing happens when I press left or right Key) ??
    Should I connect that methode to a specific SIGNAL ? if it the case wht signal should I use ?!!
    Please if someOne have a idea ..
    thanks
    Last edited by jpn; 10th April 2008 at 14:54. Reason: missing [code] tags

Similar Threads

  1. QKeyEvent
    By sonuani in forum Newbie
    Replies: 8
    Last Post: 25th February 2008, 07:38
  2. what's mean of the member of QKeyEvent
    By sunote in forum Qt Programming
    Replies: 1
    Last Post: 11th November 2007, 21:25
  3. QKeyEvent questions
    By bglidden in forum Qt Programming
    Replies: 1
    Last Post: 3rd October 2006, 06:29
  4. Posting a QKeyEvent to a QLineEdit
    By cocheci in forum Qt Programming
    Replies: 14
    Last Post: 5th June 2006, 14:54

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.