[Solved]Create icon by Qt



  • "example...":http://www.freeimagehosting.net/okfsc

    When I using QDirModel(QFileSystem will stall the gui even I use QTask), the tableView
    will show the icons of differents automatically, how could I get the icon like QDirModel do
    manually.

    I don't know how to make the title become easier to understand, sorry about that.



  • Hi there,
    Stated in the documentation it is recommended to use the QFileSystemModel instead of the QDirModel.
    In the model in the data function (which gives the view its information), there is also a FileIconRole role. Use that one to give the view a proper icon to display.
    Greetz



  • I tried QFileSystemModel before, but the QFileSystem will stall the gui even I run it on another
    thread when I need to rename a lot of files.QFileSystem will keep updating if the name of the files
    being changed, but QDirModel would not.

    Thanks, I will study and try FileIconRole.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.