生成ICO文件
#include <QApplication>
#include <QImage>
#include <QIcon>
#include <QFile>
#include <QDebug>
#include <QPixmap>int main(int argc, char* argv[])
{QApplication app(argc, argv);// 读取图片文件QImage image("D:\\MultiChannelVideo\\code\\src\\115_xviewer_test\\img\\logo_150_40.png"); // 替换为您的图片文件路径if (image.isNull()) {qDebug() << "Failed to load image.";return 1;}// 保存图像为.ico文件QString filePath = "D:\\MultiChannelVideo\\code\\src\\115_xviewer_test\\img\\output_icon.ico"; // 保存的.ico文件路径QPixmap pixmap = QPixmap::fromImage(image);if (pixmap.save(filePath, "ICO")) {qDebug() << "Icon saved to" << filePath;}else {qDebug() << "Failed to save icon.";}return app.exec();
}