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. Overlapping Delegate in listview
Forum Updated to NodeBB v4.3 + New Features

Overlapping Delegate in listview

Scheduled Pinned Locked Moved QML and Qt Quick
20 Posts 4 Posters 8.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.
  • R Offline
    R Offline
    ReshmaS
    wrote on last edited by
    #10

    can i upload the project file, will tat be easier??

    Reshma

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dmcr
      wrote on last edited by
      #11

      The code you gave is a little too long.
      Try with a simple example, the shortest ( without sorting and with fewer text for example, etc...), then you can fix the bug.

      dmcr

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ReshmaS
        wrote on last edited by
        #12

        OK will try that. Here is the file if you have time kindly go through this.

        Thanks..

        Reshma

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dmcr
          wrote on last edited by
          #13

          I will try if you give some clean code.

          dmcr

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ReshmaS
            wrote on last edited by
            #14

            http://www.2shared.com/file/-KWQrl3Z/xml_view.html

            Cleaned up my code mate. Thanks. Iwill also try to do it with simple code.

            Reshma

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dmcr
              wrote on last edited by
              #15

              here it is mate

              @import QtQuick 1.1

              Rectangle{

              width:400
              height:width
              property real ropacity:0
              
              XmlListModel {
                  id: xmlModel
              
                  source:"example_grouping.xml"
              
                  query: "/rss/channel/item"
                  XmlRole { name: "id"; query: "id/string()" }
                  XmlRole { name: "title"; query: "title/string()" }
                  XmlRole { name: "pubDate"; query: "pubDate/string()" }
                  XmlRole { name: "param"; query: "param/string()" }
                  //onStatusChanged: if (status === XmlListModel.Ready) { console.log("XML elements read: ", count); fillListModel(); sortModel(); }
              }
              
              Component {
                  id: sectionHeading
                  Rectangle {
                      id:rect1
                      width: 50
                      height:18
                      color: "lightgrey"
              
                      Text {
                          text: section
                          font.bold: true
                      }
                  }
              }
              
              Component {
                  id: mainDelegate
              
                  Item {
                      id: shortview
                      property real detailsOpacity : 0
                      width: 100
                      height: 29
              
                       state : index==idLV.currentIndex ? 'details' : ''
              
                      states: [
                          State {
                              name: ""
                              PropertyChanges { target: shortview;  height:29;}
                              PropertyChanges { target: tert;  color:"black" }
                          },
                          State {
                              name: "details" ;
                              PropertyChanges {target: shortview ; height:50; }
                              PropertyChanges {target: tert ; color:"pink" }
                          }
                      ]
              
                      Text {
                          id:tert
                          text:param
                          color : "black"
                      }
                      MouseArea {
                          id:marea
                          anchors.fill:parent
                          onClicked: idLV.currentIndex = index
                      }
                  }
              }
              
              ListView{
                  id:idLV
              
                  model:xmlModel
                  width: 180; height: 300
                  delegate:  mainDelegate
                  section.property: "param"
                  section.criteria: ViewSection.FullString
                  section.delegate: sectionHeading
              }
              

              }@

              dmcr

              1 Reply Last reply
              0
              • R Offline
                R Offline
                ReshmaS
                wrote on last edited by
                #16

                Thanks mate :).. Appreciated!

                Reshma

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  ReshmaS
                  wrote on last edited by
                  #17

                  @dmcr:

                  The first item is always on 'Details' mode.
                  I have a close button on clikcing it goes back to the old state, when I click that I am unable to access the list.
                  Chk this if u have some time. Its the code which am working on.
                  http://www.2shared.com/file/d0BduoTK/xml.html

                  "chk this":http://www.2shared.com/file/d0BduoTK/xml.html

                  Thanks

                  Reshma

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dmcr
                    wrote on last edited by
                    #18

                    In your code there is still shortview.state='shortview', but this state is not defined.
                    You had to study the documentaion a little.

                    dmcr

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      ReshmaS
                      wrote on last edited by
                      #19

                      I read the documentation it did not work and hence I reverted to the existing code. I will try in another method. in that case the first item is always on the detailed state

                      Reshma

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Macro
                        wrote on last edited by
                        #20

                        -Please edit you Question and add [Solved] infront of it, if you got the answer.-

                        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