Results 1 to 5 of 5

Thread: Listbox Autoscroll is not happening?

  1. #1
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Listbox Autoscroll is not happening?

    My window carries a listbox where all the actions are defined by myself rather than the
    default listbox operations... I am able to move across the elements of the listbox but
    not able to scroll the listbox automatically when the selection is out of display range.

    I am attaching two images that can help understand the situation.

    mahe2310
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Listbox Autoscroll is not happening?

    use
    Qt Code:
    1. QListbox::ensureCurrentVisible();
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  3. #3
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Listbox Autoscroll is not happening?

    Quote Originally Posted by sunil.thaha
    use
    Qt Code:
    1. QListbox::ensureCurrentVisible();
    To copy to clipboard, switch view to plain text mode 

    hi,

    Thanks...

    i got the result by using ensureCurrentVisible() function.

    But notice... call the function ensureCurrentVisible() immediately after setCurrentItem(i) function.
    Otherwise it may not work...

    mahe2310
    Last edited by mahe2310; 9th March 2006 at 07:59. Reason: grammer err

  4. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Listbox Autoscroll is not happening?

    Quote Originally Posted by mahe2310
    But notice... call the function ensureCurrentVisible() immediately after setCurrentItem(i) function.
    mahe2310
    Could you please make it clear ?

    AFAIK it can be called at any time to make the current Item Visible
    We can't solve problems by using the same kind of thinking we used when we created them

  5. #5
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Listbox Autoscroll is not happening?

    i called ensureCurrentVisible() at the end of all the loops in my function.
    Even if the control reached there, i couldnt make see the results.

    So i called it immediately after the setCurrentItem(i) function. It worked.

    At first i called the function after all the steps is bcos i am calling the funtion setCurrentItem(i)
    at different sub loops and hence avoid repeatd call.


    mahe2310

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.