Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to let the first ListElement don't display

How to let the first ListElement don't display

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 4 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sfjam
    wrote on last edited by
    #1

    i want to use ListView to display ListElements which provided by ListModel,but i don't want to display the first ListElement,who can help me how to do it?thank you!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      I don't think it's possible with standard methods (you could remove the first row from the model, but I take it that's not what you want). May I ask what the use case is?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sfjam
        wrote on last edited by
        #3

        because in my code i can't display the first ListElement

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          Yes, I got that, my question is, if you can't display it, why have it as a list element anyway and not e.g. as a property in the model.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            You can use a proxy model (e.g. based on [[Doc:QSortFilterProxyModel]]). Maybe you must fiddle around a bit in some C++ helper classes though.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sfjam
              wrote on last edited by
              #6

              the model is created by C++,but i needn't display the first ListElement,who can tell me how to implement this but not change the model which created by C++

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                Use a QSortFilterProxyModel, and reimplement it to return false for the row number 0 in the filterAcceptsRow() method.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved