Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法找出 QPixmap 的文件名?我的目的是测试当前设置的像素图。我试过 Squish 来找出任何属性,但我只能访问一些东西,比如宽度、高度等
我假设在您编写测试时,您已经知道要查看哪个图像。您可以转换QPixmap为QImage并检查它是否包含与预期相同的图像:
QPixmap
QImage
bool same = QImage(filename) == pixmap.toImage();
它效率不高,但对于测试目的应该没问题。