Qt之根据扩展名获取文件图标和类型

Qt之根据扩展名获取文件图标和类型_第1张图片

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->listWidget->setIconSize(QSize(48, 48));
    ui->listWidget->setResizeMode(QListView::Adjust);
    ui->listWidget->setViewMode(QListView::IconMode);
    ui->listWidget->setMovement(QListView::Static);
    ui->listWidget->setSpacing(10);
    QStringList iconTypes;
    iconTypes << "computer" << "desktop" << "trashcan" << "network" << "drive" << "folder" << "file";
    for (int i = 0; i < 7; ++i)
    {
        QFileIconProvider provider;
        QIcon icon = provider.icon(static_cast(i));

        QListWidgetItem *item = new QListWidgetItem(ui->l

你可能感兴趣的:(Qt工作笔记,Qt,文件后缀,文件类型,文件扩展名)