I forgot to say that it is only when the widget is in a sub layout (or sub-widget with an horizontal layout). Like when I have few widgets on the same line in a parent layout, the text won't show up.

Qt Code:
  1. groupBox = new QGroupBox(LogInScreen);
  2. groupBox->setObjectName(QString::fromUtf8("groupBox"));
  3. groupBoxLayout = new QVBoxLayout(groupBox);
  4. groupBoxLayout->setObjectName(QString::fromUtf8("groupBoxLayout"));
  5. titleLabel = new QLabel(groupBox);
  6. titleLabel->setObjectName(QString::fromUtf8("titleLabel"));
  7. titleLabel->setAlignment(Qt::AlignCenter);
  8.  
  9. groupBoxLayout->addWidget(titleLabel);
  10.  
  11. subTitleLabel = new QLabel(groupBox);
  12. subTitleLabel->setObjectName(QString::fromUtf8("subTitleLabel"));
  13. subTitleLabel->setAlignment(Qt::AlignCenter);
  14.  
  15. groupBoxLayout->addWidget(subTitleLabel);
  16.  
  17. middleSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  18.  
  19. groupBoxLayout->addItem(middleSpacer);
  20.  
  21. userInfoLayout = new QHBoxLayout();
  22. userInfoLayout->setSpacing(25);
  23. userInfoLayout->setObjectName(QString::fromUtf8("userInfoLayout"));
  24. userInfoLayout->setContentsMargins(0, -1, 0, -1);
  25. leftlSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  26.  
  27. userInfoLayout->addItem(leftlSpacer);
  28.  
  29. loginPasswordLayout = new QFormLayout();
  30. loginPasswordLayout->setObjectName(QString::fromUtf8("loginPasswordLayout"));
  31. loginPasswordLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
  32. loginPasswordLayout->setVerticalSpacing(15);
  33. loginLabel = new QLabel(groupBox);
  34. loginLabel->setObjectName(QString::fromUtf8("loginLabel"));
  35.  
  36. loginPasswordLayout->setWidget(0, QFormLayout::LabelRole, loginLabel);
  37.  
  38. loginLineEdit = new QLineEdit(groupBox);
  39. loginLineEdit->setObjectName(QString::fromUtf8("loginLineEdit"));
  40.  
  41. loginPasswordLayout->setWidget(0, QFormLayout::FieldRole, loginLineEdit);
  42.  
  43. passwordLabel = new QLabel(groupBox);
  44. passwordLabel->setObjectName(QString::fromUtf8("passwordLabel"));
  45.  
  46. loginPasswordLayout->setWidget(1, QFormLayout::LabelRole, passwordLabel);
  47.  
  48. passwordLineEdit = new QLineEdit(groupBox);
  49. passwordLineEdit->setObjectName(QString::fromUtf8("passwordLineEdit"));
  50. passwordLineEdit->setEchoMode(QLineEdit::Password);
  51.  
  52. loginPasswordLayout->setWidget(1, QFormLayout::FieldRole, passwordLineEdit);
  53.  
  54.  
  55. userInfoLayout->addLayout(loginPasswordLayout);
  56.  
  57. forgotSomethingLayout = new QVBoxLayout();
  58. forgotSomethingLayout->setSpacing(15);
  59. forgotSomethingLayout->setObjectName(QString::fromUtf8("forgotSomethingLayout"));
  60. forgotLoginLabel = new QLabel(groupBox);
  61. forgotLoginLabel->setObjectName(QString::fromUtf8("forgotLoginLabel"));
  62. forgotLoginLabel->setOpenExternalLinks(true);
  63.  
  64. forgotSomethingLayout->addWidget(forgotLoginLabel);
  65.  
  66. forgotPasswordLabel = new QLabel(groupBox);
  67. forgotPasswordLabel->setObjectName(QString::fromUtf8("forgotPasswordLabel"));
  68. forgotPasswordLabel->setOpenExternalLinks(true);
  69.  
  70. forgotSomethingLayout->addWidget(forgotPasswordLabel);
  71.  
  72.  
  73. userInfoLayout->addLayout(forgotSomethingLayout);
  74.  
  75. rightSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  76.  
  77. userInfoLayout->addItem(rightSpacer);
  78.  
  79.  
  80. groupBoxLayout->addLayout(userInfoLayout);
  81.  
  82. middleSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  83.  
  84. groupBoxLayout->addItem(middleSpacer_2);
  85.  
  86. buttonsLayout = new QHBoxLayout();
  87. buttonsLayout->setObjectName(QString::fromUtf8("buttonsLayout"));
  88. buttonsLeftSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  89.  
  90. buttonsLayout->addItem(buttonsLeftSpacer);
  91.  
  92. okButton = new QPushButton(groupBox);
  93. okButton->setObjectName(QString::fromUtf8("okButton"));
  94. QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
  95. sizePolicy.setHorizontalStretch(0);
  96. sizePolicy.setVerticalStretch(0);
  97. sizePolicy.setHeightForWidth(okButton->sizePolicy().hasHeightForWidth());
  98. okButton->setSizePolicy(sizePolicy);
  99.  
  100. buttonsLayout->addWidget(okButton);
  101.  
  102. cancelButton = new QPushButton(groupBox);
  103. cancelButton->setObjectName(QString::fromUtf8("cancelButton"));
  104. sizePolicy.setHeightForWidth(cancelButton->sizePolicy().hasHeightForWidth());
  105. cancelButton->setSizePolicy(sizePolicy);
  106.  
  107. buttonsLayout->addWidget(cancelButton);
  108.  
  109.  
  110. groupBoxLayout->addLayout(buttonsLayout);
  111.  
  112.  
  113. mainLayout->addWidget(groupBox);
  114.  
  115. bottomSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  116.  
  117. mainLayout->addItem(bottomSpacer);
To copy to clipboard, switch view to plain text mode 


If needed I can upload a screenshot of the bug.

Thanks for your help!
Boris