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. [SOLVED]Negative height and ListView background
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Negative height and ListView background

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 3 Posters 5.2k 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.
  • M Offline
    M Offline
    mbrasser
    wrote on last edited by
    #2

    If you can find another method of accomplishing the same thing, I'd suggest doing that instead. It is unlikely to change in QtQuick 1.x, but may very likely change in QtQuick 2.0 (with the switch to the QML scenegraph).

    Regards,
    Michael

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ixSci
      wrote on last edited by
      #3

      mbrasser, thank you for explanation. Unfortunately I didn't find another way to accomplish my goal without this "concealed feature".
      Maybe I missed something and you would suggest me something? I need to draw rectangles on the ListView element field i.e. create background for it. Currently I do it by using footer property and mirroring rectangle because in normal situation footer rectangle grows outside ListView field but I need to fill inside space.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbrasser
        wrote on last edited by
        #4

        [quote author="ixSci" date="1296543507"]Maybe I missed something and you would suggest me something? I need to draw rectangles on the ListView element field i.e. create background for it. Currently I do it by using footer property and mirroring rectangle because in normal situation footer rectangle grows outside ListView field but I need to fill inside space. [/quote]

        I'm having a hard time visualizing this -- do you have a small mockup showing what you mean?

        Regards,
        Michael

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ixSci
          wrote on last edited by
          #5

          !http://img202.imageshack.us/img202/1920/listviewo.png(listview)!
          You can see bars and lines behind the bars. Those lines are rectangles which I draw via footer and negative height. Bars are ListView delegates.
          Foot scale is a part of the footer too.

          1 Reply Last reply
          0
          • 2 Offline
            2 Offline
            2beers
            wrote on last edited by
            #6

            not sure if this is what you're looking for but you can draw rectangles with positive height and change the x,y coordinates. I think it will have the same effect.

            1 Reply Last reply
            0
            • I Offline
              I Offline
              ixSci
              wrote on last edited by
              #7

              2beers, good point. But it will end up in the same question but for y property. Because it will be negative then

              1 Reply Last reply
              0
              • 2 Offline
                2 Offline
                2beers
                wrote on last edited by
                #8

                [quote author="ixSci" date="1296661041"]2beers, good point. But it will end up in the same question but for y property. Because it will be negative then[/quote]

                I don't think there will be a problem with a negative coordinate in future releases, maybe we get some official response, however you can achieve this if you want. you sttart painting from 0,0 coordinates.

                Again I don't think there will be a problem with negative coordinates in future release, but I'm not the right person to give such guarantees.

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  ixSci
                  wrote on last edited by
                  #9

                  [quote author="2beers" date="1296661394"]
                  you sttart painting from 0,0 coordinates.
                  [/quote]
                  no, in a footer (0,0) is the bottom of a ListView instance

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbrasser
                    wrote on last edited by
                    #10

                    Hi,

                    You should be able to get the same effect with either a child or sibling of the ListView. For example:

                    @import QtQuick 1.0

                    Rectangle {
                    width: 400
                    height: 400

                    //option 1 (sibling)
                    Row {
                        x: -1; y: -1
                        Repeater {
                            model: 4
                            delegate:  Rectangle {
                                width: 100;
                                height: view.height+1
                                border.width: 1
                                color: "#cccccc"
                            }
                        }
                    }
                    
                    ListView {
                        id: view
                        anchors.fill: parent
                        model: 100
                        delegate: Item {
                            width: 400; height: 50
                            Rectangle {
                                color: "green"
                                height: 25
                                width: Math.random() * 401
                                anchors.verticalCenter: parent.verticalCenter
                            }
                        }
                    
                        //option 2 (child)
                        /*children: Row {
                            z: -1
                            x: -1; y: -1
                            Repeater {
                                model: 4
                                delegate:  Rectangle {
                                    width: 100;
                                    height: view.height+1
                                    border.width: 1
                                    color: "#cccccc"
                                }
                            }
                        }*/
                    }
                    

                    }@

                    Does something like this work for your case?

                    Regards,
                    Michael

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      ixSci
                      wrote on last edited by
                      #11

                      mbrasser, both options are great! Thank you!

                      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