Results 1 to 15 of 15

Thread: failed to assigned loader source component

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default failed to assigned loader source component

    Hi Qt Experts,

    I have a model with page element that will determine which component to be displayed in the delegate using loader.
    I encountered this error "Unable to assign QString to QQmlComponent*"
    Is my implementation correct? Is there any efficient way to do it?
    And also, how to change the page after swiping the last element?
    Btw, there is a main loader that called the Wizard.qml. Should I just change the main loader source?

    Please advise. Thanks

    Here's my code:

    Qt Code:
    1. //Wizard.qml
    2. Item {
    3. ListModel {
    4. id: wizardModel
    5. ListElement {
    6. page: "page1"
    7. }
    8. ListElement {
    9. page: "page2"
    10. }
    11. ListElement {
    12. page: "page3"
    13. }
    14. }
    15.  
    16. ListView {
    17. anchors.fill: parent
    18. focus: true
    19. highlightRangeMode: ListView.StrictlyEnforceRange
    20. orientation: ListView.Horizontal
    21. snapMode: ListView.SnapOneItem
    22. model: wizardModel
    23. delegate: WizardDelegate {}
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //WizardDelegate.qml
    2. Item
    3. {
    4. id: root
    5. width: ListView.view.width; height: ListView.view.height
    6.  
    7. Rectangle
    8. {
    9. id: header
    10. height: 100
    11. Layout.fillWidth: true
    12. color: "#00000000"
    13. clip: true
    14. anchors {
    15. top: parent.top
    16. left: parent.left
    17. right: parent.right
    18. }
    19.  
    20. Text
    21. {
    22. id: title
    23. text: "Welcome"
    24. color: "#FFFFFF"
    25. wrapMode: Text.WordWrap
    26. anchors.centerIn: parent
    27. }
    28. }
    29.  
    30. Rectangle
    31. {
    32. id: body
    33. color: "#00000000"
    34. clip: true
    35. width: parent.width
    36. height: footer.y - y
    37. anchors {
    38. top: header.bottom
    39. topMargin: 30
    40. left: parent.left
    41. right: parent.right
    42. }
    43.  
    44. Loader {
    45. id: loader
    46. sourceComponent: model.page
    47. anchors.fill: parent
    48. }
    49.  
    50. Component {
    51. id: page1
    52. Image
    53. {
    54. id: image
    55. source: "../images/icon1.png"
    56. }
    57. }
    58.  
    59. Component {
    60. id: page2
    61. Image
    62. {
    63. id: image
    64. source: "../images/icon2.png"
    65. }
    66. }
    67.  
    68. Component {
    69. id: page3
    70. Image
    71. {
    72. id: image
    73. source: "../images/icon3.png"
    74. }
    75. }
    76. }
    77.  
    78. Rectangle
    79. {
    80. id: footer
    81. Layout.fillWidth: true
    82. color: "#00000000"
    83. height: 100
    84. anchors {
    85. left: parent.left
    86. right: parent.right
    87. bottom: parent.bottom
    88. }
    89.  
    90. CustomCheckBox
    91. {
    92. id: checkbox
    93. text: "Do not show this message again."
    94. anchors {
    95. left: parent.left
    96. right: parent.right
    97. }
    98. }
    99. }
    100. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by joko; 8th January 2015 at 15:28.

Similar Threads

  1. update Loader source
    By codeman in forum Qt Quick
    Replies: 1
    Last Post: 25th July 2014, 16:21
  2. Geotechnical engineer and I have been assigned
    By Jackson Kulakowski in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2013, 18:22
  3. Replies: 2
    Last Post: 25th March 2013, 18:06
  4. Replies: 1
    Last Post: 23rd February 2013, 17:05
  5. Replies: 0
    Last Post: 23rd November 2011, 18:56

Tags for this Thread

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.