Nominate our 2022 Qt Champions!

Anyway to display a video in a view delegate?

  • Hello - using QtWidgets to display a list of image items. The images are placeholders for small video files. If the user selects one of the items in the list, I'd like the item to begin playing the video clip. Anyway to accomplish this in my delegate?

  • Well, I managed to get this working, but not in the way I had assumed/hoped it would work. Instead of playing video in the delegate, i created a QVideoWidget and parented it in the view. Then I used the selection changed signal from the view to reposition the video widget and start/stop the video playing. Also had to capture the value changed signal from the scroll bars to make the video widget visible only when the selected item is visible in the view.

    It works OK, but feels kind of like a hack to me. There ought to be some way to play the video from within the delegate, no? Then I wouldn't have to worry about all the repositioning and visibility stuff, cuz the view handles all that for me.

    Let me know if anybody has some ideas.

Log in to reply