| Home |
This example demonstrates how to use the standard QPixmap API to load a JPEG 2000 image. Be sure to install the plugin before running this example.
/**************************************************************************** ** ** Copyright (C) 2003-2007 Trolltech ASA. All rights reserved. ** ** This file is part of a Qt Solutions component. ** ** Licensees holding a valid Qt Solutions License Agreement may use this ** file in accordance with the rights, responsibilities, and obligations ** contained therein. Please consult your licensing agreement or contact ** sales@trolltech.com if any conditions of this licensing are not clear ** to you. ** ** Further information about Qt Solutions licensing is available at: ** http://www.trolltech.com/products/qt/addon/solutions/ ** or by contacting info@trolltech.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include <QtGui/QApplication> #include <QtGui/QImage> #include <QtGui/QLabel> #include <QtGui/QPixmap> int main(int argc, char *argv[]) { QApplication app(argc, argv); /* The plugin must be installed in $(QTDIR)/plugins/imageformats in order for this example to work. See the QImageIO documementation for further info. */ QLabel imageLabel(0); QPixmap pixmap; if(!pixmap.load(":/logo.jp2")) imageLabel.setText("Could not load image"); else imageLabel.setPixmap(pixmap); imageLabel.show(); return app.exec(); }
| Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Solutions |