PDA

View Full Version : Undefined behavior in my program.



ayanda83
27th October 2016, 13:23
I'm coding this program that reads pdf file from a directory and displays them in a QListView. Everything seems to be working fine except that file icons are not showing in the QListView. The code seems to be file and the listview should be displaying the icons, so I performed an experiment by throwing in a JPG file in the DIR to see if the file icon for the JPG file will display in the listview. The outcome was that when I run the program, no icon displays but when I double-click on the JPG file to open it, suddenly all the icons for the pdf documents show. I've attached to screen shots to show this behaviour the first screenshot shows the program after it's ran for the first time (as can be seen, no icons there). The second screen shows the program after I've double-click on the JPG file (suddenly the program pulls all the file icons from the dir.) What is causing this, why is the program not showing the icons automaitically1219612197

anda_skoa
27th October 2016, 14:56
Maybe the model did originally not have icons but did not notify the view when icons became available?

The double click might have triggered refetching of data from the model.

Cheers,
_

ayanda83
27th October 2016, 16:56
is there a way of resolving this? what do you suggest?

anda_skoa
27th October 2016, 18:38
If that is the case then the model needs to emit dataChanged() signals to notify the view when the icons became available.

You probably need to look at the model and see if it does that kind of deferred loading.

Cheers,
_