Quote Originally Posted by tbscope View Post
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:
  1. QWidget *myContainerWidget = new QWidget;
  2. QGridLayout *myContainingLayout = new QGridLayout;
  3.  
  4. QLabel *myLabel = new QLabel;
  5. myLabel->setText("my label");
  6.  
  7. QPushButton *myButton = new QPushButton;
  8. myButton->setText("my button");
  9.  
  10. myContainingLayout->addWidget(myLabel);
  11. myContainingLayout->addWidget(myButton);
  12.  
  13. myContainerWidget->setLayout(myContainingLayout);
  14.  
  15. myContainerWidget->show();
To copy to clipboard, switch view to plain text mode 

I am sorry, I think I was not clear. I want a windows that has a pushButton with color text displayed on it. If the press that button, my app exits.
I cant use the constructor to set text because then I cant use colorful text. Hope I am clear now. Now, what should I do?