Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 70

Thread: How to show progess in a QTreeView item ?

  1. #41
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    No, you just shouldn't implement a custom style only to make very small changes if those changes can be made using simpler methods. Especially that QItemDelegate doesn't use the style directly, so you will be doing double work. I suggest you just implement a delegate and do your custom drawing there with or without using QStyle.

  2. #42
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Any examples how to do that ?
    C++ & AMD forever

  3. #43
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    Search the forum. There are numerous threads about delegates here.

  4. #44
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    And how is ItemDelegate repainted by force ?
    C++ & AMD forever

  5. #45
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    What do you mean? The view calls the delegate when it needs to update some part of its viewport. If you want to force a redraw, just update() the viewport (whole or part of it).

  6. #46
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Where do I get viewport to update ?
    C++ & AMD forever

  7. #47
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    From the view

  8. #48
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Is it so hard to answer more widely?

    If I do so will it repaint my delegate ?
    Qt Code:
    1. QTableWidget* tableWidget = new QTableWidget(this);
    2. ItemDelegate delegate = new ItemDelegate(tableWidget);
    3. tableWidget->setItemDelegateForColumn(4, delegate);
    4. ..........................................................
    5. ..........................................................
    6. tableWidget->update();
    To copy to clipboard, switch view to plain text mode 
    Thanks in advance
    C++ & AMD forever

  9. #49
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    No, it won't repaint your delegate, it will repaint your view. The delegate can't be "repainted", it is nothing visual, it's strictly a helper object that does some work on behalf of the view.

  10. #50
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Ok Will it repaint my progressbar ? Or will it call ItemDelegate:: paint() ?
    C++ & AMD forever

  11. #51
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    It depends If nothing in the item changed, the view might not call the delegate (especially if the item is currently not visible), but in general case - yes, it will call your delegate's paint method.

  12. #52
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    In my case it doesn't want to update

    Could you suggest any other solutions ?
    C++ & AMD forever

  13. #53
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    What exactly is your usecase? What exactly did you do and what do you want to achieve?

  14. #54
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    The thing is that I have a fancy progressbar that changes its colour depending on the state of download and when I start download the color doesn't change
    It looks like on the first screenshot though it should look like on the second
    Attached Images Attached Images
    • File Type: jpg 1.jpg (4.8 KB, 34 views)
    • File Type: jpg 2.jpg (3.8 KB, 28 views)
    C++ & AMD forever

  15. #55
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    Do you update the values in the items?

  16. #56
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Quote Originally Posted by wysota View Post
    Do you update the values in the items?
    What values and where ? Did not understand at all
    C++ & AMD forever

  17. #57
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    Where do you keep the progress then?

  18. #58
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    I keep all needed values in my class that handles downloading called DownloadHolder
    C++ & AMD forever

  19. #59
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to show progess in a QTreeView item ?

    What's the point of having the view then? You should really keep those in the model or in the items. That's the whole point of having the view in the first place. Oh... and your delegate would work correctly. I suggest you read this whole thread again, it probably has some code to show you how to get a more or less complete solution.

  20. #60
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Quote Originally Posted by wysota View Post
    What's the point of having the view then?
    The purpose is displaying progress not handling logics
    C++ & AMD forever

Similar Threads

  1. Replies: 4
    Last Post: 26th September 2011, 12:02
  2. QTreeView and item editing
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 18:56
  3. QTreeView, QSortFilterProxyModel and item expansions
    By benacler in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2008, 20:30
  4. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 16:00
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.