Results 1 to 5 of 5

Thread: QTreeWidget

  1. #1
    Join Date
    Oct 2007
    Posts
    78
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default QTreeWidget

    When upArrow, downArrow, scrolling etc in applications such as konqueor, Nautilus, Windows explorer, etc there appears to be a mechanism that if you do not spend approx 1 sec on the item as you scroll it will not load the corresponding contents in the view pane.

    This stops loading views that will not be seen anyways due to quick scrolling through items in the tree. I have not looked at the QDirModel code yet to see how Qt implemented this functionality and will ultimately look there if I cannot find a simple answer.

    So my questions is there any mechanism I can use in Qt to provide the same functionality as stated above. I figured I could use single shot timers to acheive a similar effect but it did not seem like a very clean solution.

    Bob

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QTreeWidget

    Yes, you need a timer. Here's a nice way to delay tasks in Qt: http://www.qtcentre.org/forum/f-qt-p...w-8181.html#15
    J-P Nurmi

  3. #3
    Join Date
    Oct 2007
    Posts
    78
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default Re: QTreeWidget

    Thank you for the help jpn.

    But if someone scrolls down through a tree of lets say 100 entries isn't firing off 100 timers going to be a bit of a system burden?

    Depending on the timer lengths some will be expiring as others are created and it will be far less demanding then rendering every un needed widget but still seems a bit system intensive.

    Bob

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QTreeWidget

    Quote Originally Posted by coderbob View Post
    But if someone scrolls down through a tree of lets say 100 entries isn't firing off 100 timers going to be a bit of a system burden?

    Depending on the timer lengths some will be expiring as others are created and it will be far less demanding then rendering every un needed widget but still seems a bit system intensive.
    Did you look at Michiel's post? I suggest taking a closer look at it. The whole point is to keep a single timer which gets reset every time something happens. So the timer gets reset every time current index changes and doesn't get fired at all until current index remains same for a pre-defined period, a single timer interval that is.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    coderbob (21st February 2008)

  6. #5
    Join Date
    Oct 2007
    Posts
    78
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default Re: QTreeWidget

    I did but I was in error to miss such a crucial point, I apologize for missing that. I will take a closer look, thank you for pointing that out.

    Bob

    EDIT: Working like magic in a bottle. Thank you again for pointing out the finer bits I overlooked.
    Last edited by coderbob; 21st February 2008 at 11:04.

Similar Threads

  1. QTreeWidget click
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 24th October 2007, 17:47
  2. Having trouble clearing a QTreeWidget.
    By Nyphel in forum Qt Programming
    Replies: 28
    Last Post: 10th October 2007, 16:33
  3. how to add icons to QTreeWidget?
    By wei243 in forum Qt Programming
    Replies: 4
    Last Post: 21st September 2007, 09:34
  4. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 23:32
  5. few questions related to QTreeWidget
    By prakash in forum Qt Programming
    Replies: 9
    Last Post: 10th March 2006, 08:32

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
  •  
Qt is a trademark of The Qt Company.