Hi,
I use a nested layout widget instance in my subclass of QMainWindow. At runtime I get the following message on console:

QLayout: Attempting to add QLayout "" to SchulungsplanParentWidget "", which already has a layout

Do you know why ? The gui seems to be correct...

This is my constuctor of the Widget class which is the center in my QMainWindow:
Qt Code:
  1. SchulungsplanParentWidget::SchulungsplanParentWidget(QDate& p_startViewDate, QDate& p_endViewDate, QWidget *p_parent)
  2. : QWidget(p_parent)
  3. {
  4. QVBoxLayout *vBoxLayout = new QVBoxLayout(this);
  5. QHBoxLayout *hBoxLayout = new QHBoxLayout(this);
  6.  
  7. m_startViewDateLabel= new QLabel("Schulungsplan VON:");
  8. m_startViewDateEdit = new QDateEdit(p_startViewDate);
  9. m_endViewDateLabel = new QLabel("Schulungsplan BIS:");
  10. m_endViewDateEdit = new QDateEdit(p_endViewDate);
  11. m_uebernehmenButton = new QPushButton("Uebernehmen");
  12.  
  13. m_spTableView = new SchulungsplanView(this);
  14.  
  15. hBoxLayout->addWidget(m_startViewDateLabel, 1, Qt::AlignLeft);
  16. hBoxLayout->addWidget(m_startViewDateEdit, 2, Qt::AlignLeft);
  17. hBoxLayout->addWidget(m_endViewDateLabel, 1, Qt::AlignLeft);
  18. hBoxLayout->addWidget(m_endViewDateEdit, 2, Qt::AlignLeft);
  19. hBoxLayout->addWidget(m_uebernehmenButton, 1, Qt::AlignLeft);
  20.  
  21. vBoxLayout->addLayout(hBoxLayout);
  22. vBoxLayout->addWidget(m_spTableView);
  23.  
  24. connect( m_uebernehmenButton, SIGNAL(clicked() ),
  25. this, SLOT(uebernehmenButtonPressed() ) );
  26. }
To copy to clipboard, switch view to plain text mode