Results 1 to 4 of 4

Thread: Undefined behavior in my program.

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Undefined behavior in my program.

    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 automaiticallyscreen1.jpgscreen2.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Undefined behavior in my program.

    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,
    _

  3. #3
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Undefined behavior in my program.

    is there a way of resolving this? what do you suggest?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Undefined behavior in my program.

    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,
    _

Similar Threads

  1. Replies: 3
    Last Post: 10th September 2013, 22:54
  2. Replies: 5
    Last Post: 16th December 2010, 10:12
  3. Replies: 1
    Last Post: 30th April 2010, 13:25
  4. running external console program by gui program
    By alireza.mixedreality in forum Qt Programming
    Replies: 4
    Last Post: 24th April 2010, 18:05
  5. Replies: 7
    Last Post: 19th January 2008, 15:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.