Hello, I am trying to build a GUI for my OpenCV program. I would like to use Graphic View to display the processed image from OpenCV.
However, as a Qt newbie I am stuck with the basic usage of displaying a pixmap (which I planned to use for my OpenCV images). Following is the the C++ code I wrote to display a 100x100 pixel red pixmap. "gui" is the UI created with Designer (which contains a Qgraphicsview widget). The code compiles but when it runs the pixmap is not shown.
Please tell me what is wrong my code and how should I correct it. Thank you for your help!
gui.setupUi(this);
GCSpixmap
->fill
(QColor(255,
0,
0));
(gui.graphicsView)->setScene(&GCSscene);
(gui.graphicsView)->show();
gui.setupUi(this);
QGraphicsScene GCSscene;
QPixmap* GCSpixmap = new QPixmap(100,100);
GCSpixmap->fill(QColor(255,0,0));
QGraphicsPixmapItem* GCSpixmapitem = GCSscene.addPixmap(*GCSpixmap);
(gui.graphicsView)->setScene(&GCSscene);
(gui.graphicsView)->show();
To copy to clipboard, switch view to plain text mode
Bookmarks