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. Custom Elements on ListView
Forum Updated to NodeBB v4.3 + New Features

Custom Elements on ListView

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 4 Posters 3.8k 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.
  • U Offline
    U Offline
    umanno
    wrote on 2 Aug 2011, 14:39 last edited by
    #1

    Hello, I'm new to QML and I'm having some problems with listView, hope someone can help me.

    I'm trying to implement a list where the last element is different from the others so I can't use delegates as they define a common interface for all items.

    One test that I did was to change expanding delegates example to create a Flickable element and add the list and a rectangle on it but the best that I got was a rectangle over the list...

    In my application I'm trying to create a tweet list and the last element is a "More" button where the user can click to download more tweets.

    Thanks

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      QtQueries
      wrote on 2 Aug 2011, 14:51 last edited by
      #2

      One approach using Delegates could be to create an item which holds two items... one of which is your tweet and the other is your "More" button.

      Test to see if index is equal to the number of elements minus 1, if so then set the More button's visible=true and the tweet's visible to false... vice-versa if index is less than that.

      Hope that makes sense!

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on 2 Aug 2011, 15:22 last edited by
        #3

        Agreed. That should work nicely. If your items are very large and complex then you may also like to take a look at the Loader item which loads items as needed. That way you only get the actual item you want for each cell in your list rather than both but with one being hidden.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Reffy
          wrote on 3 Aug 2011, 02:14 last edited by
          #4

          It sounds like a footer is what you're looking for.

          http://doc.qt.nokia.com/4.7-snapshot/qml-listview.html#footer-prop

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on 3 Aug 2011, 07:49 last edited by
            #5

            Cool. You learn something new everyday. Thanks Reffy I can make use of that myself ;-)

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              QtQueries
              wrote on 3 Aug 2011, 10:24 last edited by
              #6

              Yep good one Reffy.

              1 Reply Last reply
              0
              • U Offline
                U Offline
                umanno
                wrote on 3 Aug 2011, 13:07 last edited by
                #7

                Reffy, I can't believe that I didn't see that on the documentation!

                Thanks everyone for the ideas, I'll be using this footer prop.

                1 Reply Last reply
                0

                1/7

                2 Aug 2011, 14:39

                • Login

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