That's because you set the button as the parent of the label. What you want doesn't work like you tried it.
Here's a better solution (don't copy and past, check it first)
Qt Code:
myLabel->setText("my label"); myButton->setText("my button"); myContainingLayout->addWidget(myLabel); myContainingLayout->addWidget(myButton); myContainerWidget->setLayout(myContainingLayout); myContainerWidget->show();To copy to clipboard, switch view to plain text mode
Bookmarks