QTableView clicked() versus doubleClicked()
-
Do you want to show the full image size ?
Otherwise creating a cache with small versions of them might be a better solution in terms of speed and only load the real version when really needed. -
Hence my suggestion, have a "pre-processing" phase where you create thumbnails to show quickly and load the complete file in the background. Once it's done notify your application and do what you need with it.
-
No I can't do thumbnails as I don't know a-priori what files are involved and there might be 100s of them.
Now back to the problem - selectionChanged works fine to detect the newly selected row to trigger image loading.
Unfortunately, double clicking on a editable cell still results in selectionChanged driving the image loading to start.
What it doesn't do is open the editor on the cell that was double clicked!
I had a quick look at the code of mouseDoubleClickEvent in QAbstractItemView.cpp, and I think it is written so that it should always open the editor. I suspect that the way mousePressedEvent() is written means that the double click event isn't generated if the selection change is driven from there (I don't think it should be driven from there - rather it should be driven from a mouseClickedEvent()) which isn't present. I do see code in mousPressedEvent() that is intended to open the editor, but don't quite "get" why that wasn't invoked.
David
-
No I can't do thumbnails as I don't know a-priori what files are involved and there might be 100s of them.
Now back to the problem - selectionChanged works fine to detect the newly selected row to trigger image loading.
Unfortunately, double clicking on a editable cell still results in selectionChanged driving the image loading to start.
What it doesn't do is open the editor on the cell that was double clicked!
I had a quick look at the code of mouseDoubleClickEvent in QAbstractItemView.cpp, and I think it is written so that it should always open the editor. I suspect that the way mousePressedEvent() is written means that the double click event isn't generated if the selection change is driven from there (I don't think it should be driven from there - rather it should be driven from a mouseClickedEvent()) which isn't present. I do see code in mousPressedEvent() that is intended to open the editor, but don't quite "get" why that wasn't invoked.
David
-
Did you keep any custom code / event filter after changing to use the selection model ?
-
Then please share a minimal compilable example that shows this behaviour.