qt - QImage in a QGraphics scene -


i quite new qt. having troubles in inserting qimage scene. please tell me how add qimage qgraphicsscene?

for use qgraphicspixmapitem add scene other qgraphicsitem.

the qgraphicspixmapitem can initialized qpixmap device-dependent representation of bitmap , can qimage example static function qpixmap::fromimage().

update (example code)

#include <qtglobal>  #if qt_version >= 0x050000     #include <qtwidgets> #else     #include <qtgui> #endif  int main(int argc, char *argv[]) {     qapplication a(argc, argv);     qimage image("test.png");      qgraphicspixmapitem item( qpixmap::fromimage(image));     qgraphicsscene* scene = new qgraphicsscene;     scene->additem(&item);      qgraphicsview view(scene);     view.show();     return a.exec(); } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -