QLabel *label = new QLabel("Hello World"); label->setAlignment(Qt::AlignCenter);
QLabel *label = new QLabel(); label->setPixmap(QPixmap(":/images/image.png")); label->setAlignment(Qt::AlignRight);
QLabel *label = new QLabel("This is a very long text"); label->setAlignment(Qt::AlignJustify); label->setWordWrap(true);This code sets the alignment of the text to be justified and enables word wrapping within the label. The package library used for these examples is Qt.