问题
I open a file of format "jpg" in qt creator ,but qt creator returns a warning with "image format not supported". I also try other format as "png" ,but the waring is same.I hope someone can give me advice on it.I really need help.
回答1:
This Warning is about PNG formats and Qt, Irrelevant to @ztono code. Read more about PNG (Portable Network Graphics) https://en.wikipedia.org/wiki/Portable_Network_Graphics
PNG has many Formats some old, some not standard for Qt. see more History_and_development You need to use Standard format in Qt.
You can convert your image to PNG Standard with Software.
OR
You can use QImage in Qt to convert your PNG pictures.
QImage *image = new QImage();
image->load("E:/Qt/TestProject/Images/connect.png");
image->save("E:/Qt/TestProject/Images/connect2.png");
Use new converted png and you will not see the warning.
来源:https://stackoverflow.com/questions/43374187/qt-open-a-jpg-file-with-warning-image-format-not-supported