Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to add a component onto the whole row of a multi-column TableView?



  • For a Qt Quick controls 2 project, I needed to create a custom TableView, containing several columns, as shown on the below screenshot:
    tableview.png

    This tree works well, however I need to add an optional progress bar, which may be visible on each item, as shown on the below image:
    tableview with progress.png

    I initially though to add this progress bar in the item delegate, however this seems not to be possible, because the delegate is called for each cell independently, and not once for the whole row. And now I have no idea about how to add a such component.

    Have anybody an idea about how to add a such progress bar to my rows?



  • Another possibility is a popup or item the appears above the delegate and tracks its position. When progress is finished then this item goes away. This would not require resizing delegates to make room. It could just sit above the delegate tracking its position inside the table.

    Edit: The trick is detecting the column and only making changes from column == 0



  • You can detect from the delegate which row the delegate is in. Also, you can provide a progress value to all delegates.

    1 Detect column 0, if progress is not 100% then display bar below normal delegate info. Make progress bar width of table. Keep rest of delegate to delegate width.
    2 For all rows resize height of delegates to allow room when progress is not 100%.

    I am not 100% sure this will work. You can also play around with the older tableview from controls 1. It has a row delegate in addition to a regular delegate.



  • Another possibility is a popup or item the appears above the delegate and tracks its position. When progress is finished then this item goes away. This would not require resizing delegates to make room. It could just sit above the delegate tracking its position inside the table.

    Edit: The trick is detecting the column and only making changes from column == 0



  • @fcarney thank you very much, I'll try that as soon as possible



  • @jeanmilost Because of z ordering issues between delegates you will most likely need a popup.