Results 1 to 11 of 11

Thread: To set focus on circumference circles when key is pressed

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To set focus on circumference circles when key is pressed

    The keys may be intercepted globally by some other application (like the desktop or the system itself) but my remarks on the paint event still stand.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: To set focus on circumference circles when key is pressed

    t why not for F10 and F11?
    The first thing to test is to see if your application does indeed the get key events.
    Set a break point in your keyPressEvent(), and see if they are being caught.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: To set focus on circumference circles when key is pressed

    Thanks for everyone. Need to call update function now its working fine and below is the code snippet
    Qt Code:
    1. switch ( event->key() )
    2. {
    3. case Qt::Key_F11:
    4. nextBoltHoleCircle = TRUE;
    5. update();
    6. break;
    7. case Qt::Key_F10:
    8. prevBoltHoleCircle = TRUE;
    9. update();
    10. break;
    11. case Qt::Key_Enter:
    12. needToDrawCircle = TRUE;
    13. update();
    14. break;
    15. default:
    16. QWidget::keyPressEvent(event);
    17. }
    To copy to clipboard, switch view to plain text mode 

    Best Regards,
    Soumya
    Last edited by wysota; 23rd February 2010 at 15:01.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To set focus on circumference circles when key is pressed

    Could you tell me if your program works properly if you press F10 or F11 and then start resizing the dialog?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: To set focus on circumference circles when key is pressed

    ya its working fine

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To set focus on circumference circles when key is pressed

    With the paintEvent() you posted earlier? Or did you change it? Could you post the complete code of your widget here as an attachment?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: To set focus on circumference circles when key is pressed

    Hi,

    I have sent the entire code in the attachment it works fine

    Regards,
    Soumya
    Attached Files Attached Files
    Last edited by soumya; 26th February 2010 at 08:03.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To set focus on circumference circles when key is pressed

    I'm afraid your application doesn't work on my system, I can't see any "holes" and you disabled resizing the dialog so I don't know how could you say that your application works when the dialog is resized The code is broken, believe me.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Performance problem with drawing circles
    By kamre in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2009, 05:35
  2. Replies: 3
    Last Post: 17th March 2008, 19:54
  3. MenuBar grabs the focus on ALT pressed.
    By Cutey in forum Qt Tools
    Replies: 7
    Last Post: 16th January 2007, 09:59
  4. MenuBar grabs focus on ALT pressed.
    By Cutey in forum Qt Programming
    Replies: 2
    Last Post: 9th January 2007, 11:45
  5. Adding numbers to circles in QPaint
    By therealjag in forum Qt Programming
    Replies: 1
    Last Post: 12th February 2006, 10:21

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
  •  
Qt is a trademark of The Qt Company.