Results 1 to 2 of 2

Thread: Highlight of an ListView

  1. #1
    Join Date
    May 2012
    Posts
    5

    Default Highlight of an ListView

    Hi, I’m using a ListView wich is shown in an Rectangle an have a problem with the quantity of shown ListModelElements.

    My ListModel includes 8 elements but I only want to show 4 of them.

    Qt Code:
    1. Rectangle {
    2. width: 340
    3. height: 339
    4.  
    5. ListView {
    6. ...
    7.  
    8. delegate: Component {
    9. Item {
    10. width: 340
    11. height: 85
    12. }
    13. }
    14.  
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 

    My First problem, I want to show 4 Items. 4* 85 = 340. But when I use height 340 instead of 339 for my Rectangle then always 5 elements shown.
    Is using height 339 the best way to show only 4 Elements?

    Second Problem is, when at start only 4 Elements shown and I navigate the highlight to the fourth Element, then the fifth Element is shown automatically.
    Is it possible to prevent this?

    I use Qt 5 alpha and QtQuick 2.0.

    Thank You for your help.

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

    Default Re: Highlight of an ListView

    I didn't test it but wouldn't it be simplier to do a
    visible:index>4
    on your delegate ?

Similar Threads

  1. QML Listview Highlight image problem
    By vikaspachdha in forum Qt Quick
    Replies: 0
    Last Post: 2nd November 2011, 09:14
  2. Replies: 0
    Last Post: 26th October 2011, 12:44
  3. highlight problem
    By supriyajn in forum Newbie
    Replies: 1
    Last Post: 20th May 2010, 19:00
  4. highlight in QTextEdit
    By ubuntudevelop78 in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 00:22
  5. Highlight row in treeview
    By supergillis in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2008, 08:49

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.