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. MacOS file system icons have changed
QtWS25 Last Chance

MacOS file system icons have changed

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 6 Posters 509 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.
  • R Offline
    R Offline
    Rory_1
    wrote on 6 Aug 2024, 14:44 last edited by
    #1

    My application used to show system icons like this running in MacOS:

    1.png

    Since sometime after Qt 6.0 they now look like this:

    2.png

    Has this change originated with a change in MacOS or Qt? If I run my application in Windows I get the expected windows file system icons.

    I can replicate this behavior with a minimal example:

    FileExplorer.pro

    QT += core gui widgets
    SOURCES += main.cpp
    

    main.cpp

    #include <QApplication>
    #include <QMainWindow>
    #include <QTreeView>
    #include <QFileSystemModel>
    #include <QVBoxLayout>
    
    class Explorer : public QMainWindow {
    
    public:
        Explorer(QWidget *parent = nullptr) : QMainWindow(parent) {
            QFileSystemModel *fileSystemModel = new QFileSystemModel(this);
            fileSystemModel->setRootPath(QDir::rootPath());
    
            QTreeView *treeView = new QTreeView(this);
            treeView->setModel(fileSystemModel);
            treeView->setRootIndex(fileSystemModel->index(QDir::homePath()));
            treeView->setSortingEnabled(true);
    
            QWidget *centralWidget = new QWidget(this);
            QVBoxLayout *layout = new QVBoxLayout(centralWidget);
            layout->addWidget(treeView);
            setCentralWidget(centralWidget);
    
            setWindowTitle("File System Explorer");
            resize(800, 600);
        }
    };
    
    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        Explorer explorer;
        explorer.show();
        return app.exec();
    }
    

    3.png

    MacOS does not appear to have changed as this is what I see in the finder:

    4.png

    Thanks in advance for any guidance.

    A 1 Reply Last reply 7 Aug 2024, 10:58
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Aug 2024, 15:29 last edited by
      #2

      Hi,

      Which version of Qt are you rubbing ?
      On which version of macOS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rory_1
        wrote on 6 Aug 2024, 15:53 last edited by
        #3

        Sonoma 14.5.
        Qt 6.7.2, 6.7, 6.5.3, 6.4.0, 6.2.0 all same behavior.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SimonSchroeder
          wrote on 7 Aug 2024, 06:51 last edited by
          #4

          You could try to use the native file dialog (it's an option in QFileDialog).

          R 1 Reply Last reply 7 Aug 2024, 13:51
          0
          • R Rory_1
            6 Aug 2024, 14:44

            My application used to show system icons like this running in MacOS:

            1.png

            Since sometime after Qt 6.0 they now look like this:

            2.png

            Has this change originated with a change in MacOS or Qt? If I run my application in Windows I get the expected windows file system icons.

            I can replicate this behavior with a minimal example:

            FileExplorer.pro

            QT += core gui widgets
            SOURCES += main.cpp
            

            main.cpp

            #include <QApplication>
            #include <QMainWindow>
            #include <QTreeView>
            #include <QFileSystemModel>
            #include <QVBoxLayout>
            
            class Explorer : public QMainWindow {
            
            public:
                Explorer(QWidget *parent = nullptr) : QMainWindow(parent) {
                    QFileSystemModel *fileSystemModel = new QFileSystemModel(this);
                    fileSystemModel->setRootPath(QDir::rootPath());
            
                    QTreeView *treeView = new QTreeView(this);
                    treeView->setModel(fileSystemModel);
                    treeView->setRootIndex(fileSystemModel->index(QDir::homePath()));
                    treeView->setSortingEnabled(true);
            
                    QWidget *centralWidget = new QWidget(this);
                    QVBoxLayout *layout = new QVBoxLayout(centralWidget);
                    layout->addWidget(treeView);
                    setCentralWidget(centralWidget);
            
                    setWindowTitle("File System Explorer");
                    resize(800, 600);
                }
            };
            
            int main(int argc, char *argv[]) {
                QApplication app(argc, argv);
                Explorer explorer;
                explorer.show();
                return app.exec();
            }
            

            3.png

            MacOS does not appear to have changed as this is what I see in the finder:

            4.png

            Thanks in advance for any guidance.

            A Offline
            A Offline
            artwaw
            wrote on 7 Aug 2024, 10:58 last edited by
            #5

            @Rory_1 Hi, I built your code.

            cc7d00ad-8f33-4aa4-b5d3-c0194eb2a4ee-image.png

            File icons are OK, folder icons are somewhat "generic". Looks like model gets its decoration role from a different source? I only have the Qt 6.7.2 here so I trust you when you say it's same for different versions. That would also imply something changed in OS libraries from where the Qt gets the icons?

            For more information please re-read.

            Kind Regards,
            Artur

            R 1 Reply Last reply 7 Aug 2024, 13:38
            0
            • A artwaw
              7 Aug 2024, 10:58

              @Rory_1 Hi, I built your code.

              cc7d00ad-8f33-4aa4-b5d3-c0194eb2a4ee-image.png

              File icons are OK, folder icons are somewhat "generic". Looks like model gets its decoration role from a different source? I only have the Qt 6.7.2 here so I trust you when you say it's same for different versions. That would also imply something changed in OS libraries from where the Qt gets the icons?

              R Offline
              R Offline
              Rory_1
              wrote on 7 Aug 2024, 13:38 last edited by
              #6

              @artwaw Thanks for verifying my results.

              1 Reply Last reply
              0
              • S SimonSchroeder
                7 Aug 2024, 06:51

                You could try to use the native file dialog (it's an option in QFileDialog).

                R Offline
                R Offline
                Rory_1
                wrote on 7 Aug 2024, 13:51 last edited by
                #7

                @SimonSchroeder Thanks for the suggestion Simon. My application subclasses QFileSystemModel in order to show the user the count of images in a folder, and displays the QTreeView in a QDockWidget, so using QFileDialog is not going to work. I could substitute the native icons in the QFileSystemModel data update, but I'm hoping for a better solution.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 8 Aug 2024, 20:06 last edited by
                  #8

                  It seems that 6.6.3 is not suffering from that issue but indeed 6.7.2 does.

                  A build from the dev branch however is showing things correctly again so it might already be fixed for 6.8.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  R 1 Reply Last reply 9 Aug 2024, 12:21
                  0
                  • S SGaist
                    8 Aug 2024, 20:06

                    It seems that 6.6.3 is not suffering from that issue but indeed 6.7.2 does.

                    A build from the dev branch however is showing things correctly again so it might already be fixed for 6.8.

                    R Offline
                    R Offline
                    Rory_1
                    wrote on 9 Aug 2024, 12:21 last edited by
                    #9

                    @SGaist Thanks!! I'll mark this as solved.

                    1 Reply Last reply
                    0
                    • R Rory_1 has marked this topic as solved on 9 Aug 2024, 12:21
                    • R Offline
                      R Offline
                      Rory_1
                      wrote on 9 Aug 2024, 14:01 last edited by
                      #10

                      Followup: Qt 6.8 beta 2 does indeed resolve this issue. Many thanks to the Qt team.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        Ghenady
                        wrote on 11 Jan 2025, 19:35 last edited by
                        #11

                        Noticed this on Windows. Is there a way to switch between native icons and those custom? They suit nice on dark theme with Fusion style.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          Steven_314
                          wrote 20 days ago last edited by
                          #12

                          Seeing this behavior on Windows with 6.8.3, was there a QTBUG tracking this behavior and/or fix that may have more information?

                          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