生成ICO文件
- #include
- #include
- #include
- #include
- #include
- #include
-
- 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();
- }


