×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    How to define a vertical scrolling offset in a listView?

    Hey all!

    How can I do this? I want to make it possible for user to click on items in a listView (through using indexAt(mouseX, mouseY) in a MouseArea of listView). But to make it working properly (to define proper item's index) I need to define a vertical offset of scrolling. So is there any ways to solve my problem? Or is there some other ways to make it working properly?

    Thank you very much!

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to define a vertical scrolling offset in a listView?

    i you want to click on items in a listview, add a mousearea in your delegate

  3. #3
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    Re: How to define a vertical scrolling offset in a listView?

    Wow! Thanks, it is working!

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    228

    Re: How to define a vertical scrolling offset in a listView?

    I have similar problem, but instead of just be able to click on Item I need to know the currentIndex of the clicked item. Is there any way to detect it? Thanks in advance
    http://inmobisoft.com

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to define a vertical scrolling offset in a listView?

    in your delegate, you can access the property "index" (see http://doc.qt.nokia.com/4.7-snapshot...#delegate-prop )

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    228

    Re: How to define a vertical scrolling offset in a listView?

    Oh, seems to find the way:

    MouseArea {
    id: itemMouseArea;
    anchors.fill: parent;
    onPressed: {
    myListView.currentIndex = myListView.indexAt (itemMouseArea.mouseX + myListView.contentX, itemMouseArea.mouseY + myListView.contentY);
    }
    }

    even headers treated correctly
    http://inmobisoft.com

  7. #7
    Registered User
    Join Date
    Oct 2010
    Posts
    228

    Re: How to define a vertical scrolling offset in a listView?

    Quote Originally Posted by njzk2 View Post
    in your delegate, you can access the property "index" (see http://doc.qt.nokia.com/4.7-snapshot...#delegate-prop )
    aha, that's another way thanks a lot for help
    http://inmobisoft.com

  8. #8
    Registered User
    Join Date
    Oct 2010
    Posts
    228

    Re: How to define a vertical scrolling offset in a listView?

    Quote Originally Posted by njzk2 View Post
    in your delegate, you can access the property "index" (see http://doc.qt.nokia.com/4.7-snapshot...#delegate-prop )
    Hmm, I've replied to early. How to access the index property? Delegate ID doesn't work. Thanks in advance for your help

    Update: delegat ID was not needed. Now works. Thanks
    Last edited by pippo2010; 2011-02-25 at 15:18.
    http://inmobisoft.com

  9. #9
    Nokia Developer Champion
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to define a vertical scrolling offset in a listView?

    quite easy :
    Code:
    ListView {
        model: yourModel
        delegate: Item {
            // Do stuff your delegate does
            MouseArea {
                anchors.fill: parent
                onClicked: {
                    myListView.currentIndex = index
                }
            }
        }
    the index property is always accessible in the delegate item

Similar Threads

  1. Vertical scrolling in editor over a large image
    By hclemson in forum Symbian User Interface
    Replies: 2
    Last Post: 2012-02-23, 11:17
  2. How to set timezone offset in S60 3rd
    By yaohongwang in forum Symbian C++
    Replies: 3
    Last Post: 2008-07-09, 15:03
  3. Vertical Scrolling in Canvas
    By daisy_deepa@yahoo.com in forum Mobile Java Games
    Replies: 2
    Last Post: 2007-10-16, 18:04
  4. Vertical scrolling text with background
    By Elwoodini in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-04-23, 00:15
  5. Vertical scrolling text
    By Elwoodini in forum Mobile Java General
    Replies: 0
    Last Post: 2003-04-02, 01:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •