This is what I find:
QString filename
= QFileDialog::getOpenFileName(this, tr
("选择要添加的程序"), qApp
->applicationDirPath
(), tr
("Excutable(*.*)"));
if(filename.isEmpty())
{
return;
}
QIcon icon
= seekIcon.
icon(fileInfo
);
if(!pixmap.save(tr("%1.png").arg(fileInfo.baseName()), "png"))
{
qDebug() << "Save icon failed!!";
return;
}
else
{
qDebug() << "Save icon succeeded!!!";
}
QString filename = QFileDialog::getOpenFileName(this, tr("选择要添加的程序"), qApp->applicationDirPath(), tr("Excutable(*.*)"));
if(filename.isEmpty())
{
return;
}
QFileInfo fileInfo(filename);
QFileIconProvider seekIcon;
QIcon icon = seekIcon.icon(fileInfo);
QPixmap pixmap = icon.pixmap(QSize(15, 15));
if(!pixmap.save(tr("%1.png").arg(fileInfo.baseName()), "png"))
{
qDebug() << "Save icon failed!!";
return;
}
else
{
qDebug() << "Save icon succeeded!!!";
}
To copy to clipboard, switch view to plain text mode
hope it can help you!
Bookmarks