Results 1 to 6 of 6

Thread: go focus to The Next Element in qml

  1. #1
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default go focus to The Next Element in qml

    Like the following picture:
    focus.gif
    By pressing the tab,focus Change.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: go focus to The Next Element in qml


  3. The following user says thank you to anda_skoa for this useful post:

    ravandi (12th November 2015)

  4. #3
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: go focus to The Next Element in qml

    My problem is:
    with press Button tab ,Focus doesn"t go to Next Element!

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: go focus to The Next Element in qml

    Then you'll have to show the code that exhibits the problem.

    Cheers,
    _

  6. #5
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: go focus to The Next Element in qml

    Qt Code:
    1. import QtQuick 2.0
    2. import QtQuick.Controls 1.1
    3.  
    4. Rectangle {
    5. id: root
    6. color: "#ffffff"
    7. width: 320
    8. height: 320
    9. border.width: 5
    10. border.color: "#000000"
    11.  
    12. Rectangle {
    13. id: mo
    14. x: 100
    15. y: 8
    16. width: 110
    17. height: 20
    18. border.width: 1
    19. border.color: "#000000"
    20. radius: 10
    21. focus: true
    22. }
    23.  
    24. TextEdit {
    25. id: textEdit1
    26. x: 100
    27. y: 8
    28. width: 110
    29. height: 20
    30. text: ctrl.name
    31. font.pixelSize: 12
    32. clip:true
    33. focus: true
    34. }
    35.  
    36. Button {
    37. id: button1
    38. x: 130
    39. y: 34
    40. width: 50
    41. height: 27
    42. focus: true
    43. text: qsTr("ارسال")
    44. onClicked: {
    45. ctrl.name = textEdit1.text
    46. ctrl.hello()
    47. }
    48.  
    49. }
    50.  
    51. Text {
    52. id: text1
    53. x: 100
    54. y: 67
    55. width: 110
    56. height: 23
    57. text: ctrl.message
    58. font.pixelSize: 12
    59. }
    60. }
    To copy to clipboard, switch view to plain text mode 

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: go focus to The Next Element in qml

    The Rectangle doesn't need focus, it doesn't deal with keyboard input.

    And your code snippet is missing the KeyNavigation entries.

    Cheers,
    _

  8. The following user says thank you to anda_skoa for this useful post:

    ravandi (13th November 2015)

Similar Threads

  1. Get the first element of a ListView
    By nick85 in forum Qt Quick
    Replies: 2
    Last Post: 2nd September 2013, 13:47
  2. Replies: 9
    Last Post: 23rd April 2012, 13:53
  3. QWebView - how to focus in a flash element ?
    By rsilva in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2011, 22:35
  4. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00
  5. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09

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.