- 
    Bug 
- 
    Resolution: Fixed
- 
    P2: Important 
- 
    6.8.2, 6.9.1
- 
    Pixel 4 API Level 31 Emulator; iOS 18.2 Simulator
- 
        
- 
        560bf5a07 (dev), 4a4d11c17 (6.10), 563f2273f (dev), f036bd0ed (dev), 8d795f529 (6.10), 5cf2a29fd (dev), ae4e6bd4c (dev), 7c574a09b (6.10), 4ba8601b7 (dev)
Code
#include <QtWidgets> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget win; auto layout = new QVBoxLayout(&win); QAbstractFileIconProvider provider; QMap<QString, QIcon> iconMap { {"Computer", provider.icon(QAbstractFileIconProvider::Computer)}, {"Desktop", provider.icon(QAbstractFileIconProvider::Desktop)}, {"Trashcan", provider.icon(QAbstractFileIconProvider::Trashcan)}, {"Network", provider.icon(QAbstractFileIconProvider::Network)}, {"Drive", provider.icon(QAbstractFileIconProvider::Drive)}, {"Folder", provider.icon(QAbstractFileIconProvider::Folder)}, {"File", provider.icon(QAbstractFileIconProvider::File)}, {"CSV File", provider.icon(QFileInfo("dummy.csv"))}, {"JPG File", provider.icon(QFileInfo("dummy.jpg"))}, {"PDF File", provider.icon(QFileInfo("dummy.pdf"))} }; for (const auto& key : iconMap.keys()) { auto icon = iconMap[key]; qDebug() << key << "Icon null?:" << icon.isNull(); layout->addWidget(new QPushButton(icon, key)); } win.show(); return a.exec(); }
Outcomes
- (Windows/macOS) All icons are not null; the buttons show text + icons (Expected)
- (Android/iOS) All icons are null; the buttons only show text (Not Expected)
Notes
Changing from QAbstractFileIconProvider to QFileIconProvider makes icon(QAbstractFileIconProvider::IconType) return icons on the mobile platforms, but this imposes a dependency on Qt Widgets. It also doesn't help icon(const QFileInfo &)
- relates to
- 
                    QTBUG-124829 The appearance of icons in QFileSystemModel is simplified and differs from the typical Windows icons. -         
- Closed
 
-         
- 
                    QTBUG-134240 Clarify the split between QAbstractFileIconProvider + QFileIconProvider -           
- Reported
 
-         
- mentioned in
- 
                    Page Loading... 
