문제

Is there a way to find out the filename of a QPixmap? My intention was to test which pixmap is currently set. I've tried Squish to find out any properties, but I've get only access to some stuff like width, height etc

도움이 되었습니까?

해결책

I assume that while you writing a test you already know which image you want to see. You can convert QPixmap to QImage and check if it contains the same image as expected:

bool same = QImage(filename) == pixmap.toImage();

It's not efficient but should be ok for testing purposes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top