PDA

View Full Version : Synchronize a list and a viewer



MTK358
27th September 2010, 22:33
I have a QStandardItemModel full of filenames, and a file viewer widget. How do I synchronize the currently viewed file with the list's current item?

Lykurg
27th September 2010, 22:56
With signal and slots.

MTK358
29th September 2010, 19:10
I tried doing it with the currentChanged() signal, but it's not emitted when the list is cleared or when it's not in focus.

kornicameister
29th September 2010, 19:27
.... file viewer widget....

which is ?
I am asking because I once used QTreeWidget and it's signal
itemSelectionChanged() and I had no problems both when selection was changed with mouse or key... though I can't really check if it would work in your case

nevertheless You can try it out

MTK358
29th September 2010, 19:31
I had no problems both when selection was changed with mouse or key...

Items will be added, removed, and cleared without the list being in focus.

kornicameister
29th September 2010, 20:02
to be honest I can not say a word about removing or clearing the list of items because I had to abandon writing it due to other more important project I am working on right now

If I find some time, I will go for it to check it out