1 QString filename = QFileDialog::getOpenFileName(this, tr("选择要添加的程序"),
2 qApp->applicationDirPath(), tr("Excutable(*.*)"));
3 if(filename.isEmpty())
4 {
5 return;
6 }
7 QFileInfo fileInfo(filename);
8 QFileIconProvider seekIcon;
9 QIcon icon = seekIcon.icon(fileInfo);
10 QPixmap pixmap=icon.pixmap(QSize(15,15));
11 if(!pixmap.save(tr("%1.png").arg(fileInfo.baseName()),"png"))
12 {
13 qDebug()<<"Save icon failed!!"