读书人

怎的将画好的图形输出到图片文件

发布时间: 2012-12-31 11:57:52 作者: rapoo

怎样将画好的图形输出到图片文件?
在pixmap中已经画好,怎样输出为图片文件?
[解决办法]
bool QPixmap::save ( const QString & fileName, const char * format = 0, int quality = -1 ) const

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns fals

The quality factor must be in the range [0,100] or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings

试试:
QPixmap _pixmap;
//画你的pixmap
然后调用:
_pixmap.save("你的文件名 例:output","文件格式 例:PNG");
应该就可以了

读书人网 >QT开发

热点推荐