zy1233:你读取svg的代码贴一下?
(2020-12-01 09:42)
//QImageReader ir(":/_noinclude/resource/SegyToText.svg");
//QImageReader ir("E:/engineer/GeoDataProcess/code/DataFormatConversion/SegyToText/_noinclude/resource/SegyToText.svg");
//auto ic = new QIcon(
// QPixmap::fromImage(ir.read(), Qt::ColorOnly));// .scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
//QPixmap pixmap(16, 16);
//QPainter qPainter(&pixmap);
//QSvgRenderer m_svgRender;
//
//m_svgRender.load(QString("E:/engineer/GeoDataProcess/code/DataFormatConversion/SegyToText/_noinclude/resource/SegyToText.svg"));
//m_svgRender.render(&qPainter, QRectF(0, 0, 16, 16));
//auto ic = new QIcon(pixmap);
//return ic;
//QPixmap pixmap(":/_noinclude/resource/SegyToText.svg");
//return new QIcon(pixmap.scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
return new QIcon(":/_noinclude/resource/SegyToText.png");
都试过了,感觉Qt对svg中的text对象支持不太够