I'm using a QTreeView to display a directory tree rooted at an SSHFS mount. This works well, but if I expand a node containing ~150 files or more there is a significant delay between clicking the '>' expand arrow and having the node visually expand, on the order of several seconds. This only occurs the first time the node is expanded; thereafter it opens immediately.
I would like to simply change to a busy cursor when the expand button is clicked, then switch back to normal when expansion is complete.
I have tried extending QTreeView and overriding the expand() slot, calling the QTreeView expand function between calls to change the cursor appearance, but this slot never gets called when manipulating the view. Connecting to the expanded signal seems to trigger immediately when the '>' icon is clicked, but there is no signal I've found that indicates when the expansion has completed.
How can I do this? The view does nothing on the first expansion for several seconds, which is disconcerting to the user. I just want some indication that the view is still working, just cogitating for a few moments.