Results 1 to 4 of 4

Thread: Signal emit Issue - Listview is not showing full list

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2016
    Posts
    53
    Thanks
    13
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Signal emit Issue - Listview is not showing full list

    Hi,


    I am binding an ListView with values passing from the cpp, Pls refer the code.

    Issue: Listview displays only one row, mean first value, The rest of the rows are not appeared.

    Checked:
    I created an ListModel/ListElement in main.qml as test and bind with ListView, Now the Listview just working fine, display all values

    I suspect after the signal emit, the error occurs.

    Code snippet:

    main.qml
    ----------
    Qt Code:
    1. ListView {
    2. id: idListView
    3. anchors {
    4. left: parent.left
    5. leftMargin: 10 * scaleFactor
    6. right: parent.right
    7. rightMargin: 10 * scaleFactor
    8. top: rectangleToolBar.bottom
    9. topMargin: 10 * scaleFactor
    10. bottom: rectangleStatusBar.top
    11. bottomMargin: 10 * scaleFactor
    12. }
    13. // model: objHomeController.detailsModel // Display only one row
    14. //model: idListmodel //Working fine
    15. delegate: comsearchDelegate
    16. spacing: 10 * scaleFactor
    17. clip: true
    18.  
    19. highlight: Rectangle {
    20. color: 'grey'
    21. Text {
    22. anchors.centerIn: parent
    23. color: 'white'
    24. }
    25. }
    26. focus: true
    27. }
    28.  
    29.  
    30. Component {
    31.  
    32. id: comsearchDelegate
    33. Row {
    34. spacing: 10 * scaleFactor
    35.  
    36. Column {
    37. Layout.alignment: Qt.AlignTop
    38.  
    39. Text { text: title; font { pixelSize: 14 * scaleFactor; bold: true } }
    40. Text { text: description; font { pixelSize: 14 * scaleFactor; bold: true } }
    41.  
    42. }
    43. }
    44. }
    45.  
    46. ListModel
    47. {
    48.  
    49. id: idListModel
    50. ListElement{
    51. title : "sdfsdf";
    52. description:"sdfsdfs";
    53.  
    54. }
    55. ListElement{
    56. title : "sdfsdf";
    57. description:"sdfsdfs";
    58.  
    59. }
    60. ListElement{
    61. title : "sdfsdf";
    62. description:"sdfsdfs";
    63.  
    64. }
    65. ListElement{
    66. title : "sdfsdf";
    67. description:"sdfsdfs";
    68.  
    69. }
    70. }
    To copy to clipboard, switch view to plain text mode 
    HomeController.h
    --------------------
    Qt Code:
    1. Q_PROPERTY(Model* detailsModel READ get_detailsModel WRITE set_detailsModel NOTIFY detailsModelChanged )
    To copy to clipboard, switch view to plain text mode 
    HomeController.cpp
    --------------------
    Qt Code:
    1. void HomeController::set_detailsModel(Model* value)
    2. {
    3. m_detailsModel = value;
    4.  
    5. //value has correct values - checked.
    6. emit detailsModelChanged(value);
    7. }
    To copy to clipboard, switch view to plain text mode 
    Thanks in advacne
    Last edited by anda_skoa; 14th October 2016 at 17:24. Reason: missing [code] tags

Similar Threads

  1. issue with loading QML ListView through C++
    By ejoshva in forum Newbie
    Replies: 1
    Last Post: 17th July 2015, 09:57
  2. listview issue
    By joko in forum Qt Quick
    Replies: 0
    Last Post: 13th July 2015, 18:17
  3. Replies: 6
    Last Post: 26th August 2014, 22:50
  4. Issue with List of objects made of QObject
    By alizadeh91 in forum Qt Programming
    Replies: 4
    Last Post: 3rd June 2013, 20:38
  5. Day showing wrongly in thread list in NewBie
    By karthic in forum General Discussion
    Replies: 1
    Last Post: 29th April 2012, 14:06

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.