Results 1 to 4 of 4

Thread: remove rows loop in qml

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

    Default remove rows loop in qml

    how to remove rows in loop?
    like this video:
    hazf.gif

    my code:
    Qt Code:
    1. import QtQuick 2.0
    2.  
    3. Rectangle {
    4. id: base;
    5. width:600;
    6. height: 800;
    7.  
    8. Column {
    9. spacing: 5;
    10.  
    11. Repeater {
    12. model: 5;
    13. delegate: Rectangle {
    14. width: 100;
    15. height: 20;
    16. color: "white";
    17. border { width: 1; color: "black" }
    18. radius: 3;
    19.  
    20. Image
    21. {
    22. id: hazf
    23. source: "pic/hazf.gif"
    24. width:20
    25. height:20
    26. }
    27.  
    28. }
    29. }
    30. }
    31. }
    To copy to clipboard, switch view to plain text mode 

  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: remove rows loop in qml

    You just decrement your model value.

    Cheers,
    _

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

    ravandi (27th March 2016)

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

    Default Re: remove rows loop in qml

    no,The rectangles are not the same,Each has a name.
    hazf4.gif

  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: remove rows loop in qml

    Then the code you've posted is not the code you are using.

    But the general idea still stands: remove the entry from the model, the repeater will remove the delegate instance

    Cheers,
    _

Similar Threads

  1. Remove selected rows from a QTableView
    By niko in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2016, 12:49
  2. How to remove a multiple selection of rows
    By aguleo in forum Newbie
    Replies: 3
    Last Post: 11th December 2013, 03:53
  3. QStandardItem remove rows and row count
    By mqt in forum Qt Programming
    Replies: 5
    Last Post: 5th October 2013, 19:22
  4. Replies: 2
    Last Post: 15th August 2011, 00:26
  5. Replies: 5
    Last Post: 2nd April 2007, 08:57

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.