i am doing a project in QT, Can any one tell me how to make a images (.jpeg) using QT.... ,I cant find how to place a QLabel in the mainwindow thought Graphics View.
Thank you in advance
i am doing a project in QT, Can any one tell me how to make a images (.jpeg) using QT.... ,I cant find how to place a QLabel in the mainwindow thought Graphics View.
Thank you in advance
Code:QLabel * label_img = new QLabel (this); QPixmap * pic_img = new QPixmap ( "d1/d2/img.jpg"); label_img -> setPixmap (pixmap_img *); QGridLayout gridLayout * = new QGridLayout; gridLayout -> addWidget (label_img); setLayout (gridLayout);
Code:#include ... int main(int arg, char *arg[]) { QApplication a(arg, arg); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsPixmapItem item(QPixmap("d:\\image.png")); scene.addItem(&item); view.show(); return b.exec(); }
Code:QWidget * widget = new QWidget; QLabel * label = new QLabel; QPixmap * pic_img = new QPixmap ( "1.jpg"); / / 1 is in the directory that contains exe label -> setPixmap (pic_img *); QGridLayout gridLayout * = new QGridLayout (widget); gridLayout -> addWidget (label, 0, 0); setLayout (gridLayout); widget -> show ();
Bookmarks