Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change icons of QFileSystemModel ?
Qt 6.11 is out! See what's new in the release blog

How to change icons of QFileSystemModel ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 4.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by sonichy
    #1

    alt text
    System: Deepin Linux
    Source Code: https://github.com/sonichy/HTYFileManager

    https://github.com/sonichy

    jsulmJ joeQJ 5 Replies Last reply
    0
    • sonichyS sonichy

      alt text
      System: Deepin Linux
      Source Code: https://github.com/sonichy/HTYFileManager

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sonichy Could you please ask a more specific question?
      Or do you expect others to read your source-code and try to find out or guess what the problem is?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      sonichyS 1 Reply Last reply
      0
      • sonichyS sonichy

        alt text
        System: Deepin Linux
        Source Code: https://github.com/sonichy/HTYFileManager

        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by
        #3

        @sonichy Hi, friend, welcome. what's system you used ? are you from china?

        Just do it!

        1 Reply Last reply
        0
        • sonichyS sonichy

          alt text
          System: Deepin Linux
          Source Code: https://github.com/sonichy/HTYFileManager

          joeQJ Offline
          joeQJ Offline
          joeQ
          wrote on last edited by
          #4

          @sonichy Hi, I saw the code. This project is not complicated. so, if you watched the code, and debug it. you will know the way, how to change the icons. Please read the code carefully.

          Just do it!

          sonichyS 1 Reply Last reply
          0
          • jsulmJ jsulm

            @sonichy Could you please ask a more specific question?
            Or do you expect others to read your source-code and try to find out or guess what the problem is?

            sonichyS Offline
            sonichyS Offline
            sonichy
            wrote on last edited by
            #5

            @jsulm Queston is specific: How to change icon after QFileSystemModel bind to system directory. To realize image preview.

            https://github.com/sonichy

            thamT 1 Reply Last reply
            0
            • joeQJ joeQ

              @sonichy Hi, I saw the code. This project is not complicated. so, if you watched the code, and debug it. you will know the way, how to change the icons. Please read the code carefully.

              sonichyS Offline
              sonichyS Offline
              sonichy
              wrote on last edited by
              #6

              @joeQ I wrote the code, I am looking for a solution to this issue.

              https://github.com/sonichy

              joeQJ 1 Reply Last reply
              0
              • sonichyS sonichy

                @joeQ I wrote the code, I am looking for a solution to this issue.

                joeQJ Offline
                joeQJ Offline
                joeQ
                wrote on last edited by joeQ
                #7

                @sonichy oh, sorry, i misunderstood you.let's help you. Friend, Are you come from Jiuzhaigou in Sichuan Province ?

                Just do it!

                sonichyS 1 Reply Last reply
                0
                • sonichyS sonichy

                  alt text
                  System: Deepin Linux
                  Source Code: https://github.com/sonichy/HTYFileManager

                  joeQJ Offline
                  joeQJ Offline
                  joeQ
                  wrote on last edited by
                  #8

                  @sonichy

                  QIcon QFileSystemModel::fileIcon(const QModelIndex &index) const
                  Returns the icon for the item stored in the model under the given index.
                  

                  we can get the QIcon from the QFileSystemModel from QModelIndex. How to set the QIcon ?

                  would you try setdata use the QFileSystemModel::FileIconRole ?

                  Just do it!

                  1 Reply Last reply
                  0
                  • sonichyS sonichy

                    alt text
                    System: Deepin Linux
                    Source Code: https://github.com/sonichy/HTYFileManager

                    joeQJ Offline
                    joeQJ Offline
                    joeQ
                    wrote on last edited by
                    #9

                    @sonichy Also use the

                    void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
                    Sets the provider of file icons for the directory model.
                    

                    Try it again.

                    Just do it!

                    1 Reply Last reply
                    0
                    • joeQJ joeQ

                      @sonichy oh, sorry, i misunderstood you.let's help you. Friend, Are you come from Jiuzhaigou in Sichuan Province ?

                      sonichyS Offline
                      sonichyS Offline
                      sonichy
                      wrote on last edited by
                      #10

                      @joeQ 我来自中国湖南衡阳

                      https://github.com/sonichy

                      1 Reply Last reply
                      0
                      • sonichyS sonichy

                        @jsulm Queston is specific: How to change icon after QFileSystemModel bind to system directory. To realize image preview.

                        thamT Offline
                        thamT Offline
                        tham
                        wrote on last edited by tham
                        #11

                        @sonichy said in How to change icons of QFileSystemModel ?:

                        Queston is specific: How to change icon after QFileSystemModel bind to system directory. To realize image preview.

                        Next time please describe more details in your post, we do not have supernatual power, it is hard to guess what do you want to do. Your problem may seem obvious to yourself, but usually this is not true for other, that is why we need to give more information when asking questions.

                        If you want to post your codes and expect us to read it, please make a minimal one, make your classes, functions as short as possible(I believe most of us think small classes and functions easier to read than large one), do not put all of the codes at once. Your long classes and functions may seem clear for you within 3 months, but not for other.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved