QLabel *label = new QLabel("Hello World"); label->setMinimumSize(100, 50);
QPixmap pixmap("image.png"); QLabel *label = new QLabel; label->setPixmap(pixmap); label->setMinimumSize(500, 300);This code loads an image from a file and displays it in a QLabel widget. The setMinimumSize function sets the minimum size of the QLabel widget to 500x300. In both examples, the package library used is QtGui.