Results 1 to 3 of 3

Thread: List delegate flicks outside of container

  1. #1
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default List delegate flicks outside of container

    Container

    Qt Code:
    1. Rectangle {
    2. id: menuCont
    3. width: 350; height: 301; x: -(parent.width * 500); y: 460;
    4. color: "Black";
    5.  
    6. ListView {
    7. id: menuListView; model: iconModel; delegate: Common.MenuDelegate { } z: 2
    8. width: parent.width; height: parent.height; x: -(parent.width * 500); y: 460; cacheBuffer: 100;
    9. spacing: 2; anchors.fill:parent
    10.  
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

    MenuDelegate

    Qt Code:
    1. import QtQuick 1.0
    2.  
    3. Component {
    4. Item {
    5. id: wrapper; width: 344; height: 301
    6. Item {
    7. id: moveMe
    8.  
    9. Rectangle {
    10. id: menuItem
    11. width: 344; height: 57; color: "#00000000"; smooth: true
    12. Image { source: "../Logic/images/textbox/directory.png" }
    13.  
    14. Behavior on opacity { PropertyAnimation { duration: 1000 } }
    15. MouseArea { anchors.fill: parent; onClicked: menuItem.opacity = 0.2 }
    16. }
    17. Column {
    18. x: 15; y: 15; width: wrapper.ListView.view.width
    19. Text { text: xName; color: "white"; width: parent.width; font.pixelSize: 20; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
    20. }
    21. }
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 

    screenshot.png

    if you look at the screen shot you see that the menuItem is outside of the menuListView
    **Red lines show where the listview should reside

    What am i doing wrong for this to happen?

  2. #2
    Join Date
    Nov 2010
    Posts
    82
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: List delegate flicks outside of container

    you need to set clip: true to your listview

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

    prophet0 (13th April 2012)

  4. #3
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: List delegate flicks outside of container

    Thank you I have been searching forever

    Again thanks very much works awesome

Similar Threads

  1. Replies: 9
    Last Post: 8th March 2011, 08:35
  2. List-based class container for Gui?
    By naturalpsychic in forum Qt Programming
    Replies: 10
    Last Post: 29th January 2011, 12:59
  3. Replies: 0
    Last Post: 4th April 2009, 15:54
  4. Quick ? about qSort(Container & container)
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2007, 11:20
  5. Replies: 1
    Last Post: 22nd October 2007, 02:04

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.