Qt 에서 간단하게 label을 이용해 이미지를 출력하는 방법입니다.
Qt가 익숙하지 않으신 분들은 약식 코드로 보면 좀 어려운 점이 있더군요. main.cpp를 이용한 전체 소스를 보이겠습니다.
main.cpp 파일
#include <QApplication> #include <QLabel> #include <QImage> #include <QPixmap> int main(int argc, char **argv) { QApplication app(argc, argv); QLabel *label = new QLabel("test"); QImage image; QPixmap buffer; image.load("image.gif"); buffer = QPixmap::fromImage(image); label->setPixmap(buffer); label->show(); return app.exec(); }
예외 처리나 이런 부분 없고 딱 이미지만 띄우는 형태입니다. ^^ 간단하게 필요하신 분들은 저정도도 괜찮을 것 같습니다.
참고
http://goo.gl/FND35