I have a QMainWindow class object with menu and toolbar. When I compiled it everything was OK. But when I added a QVBoxLayout class object with rest stuff, I cannot see a toolbar. Only menu. What must I do to repair it? My constructor looks that:
Qt Code:
  1. dialog::dialog(QWidget *parent, const char *name) : QMainWindow(parent, name)
  2. {
  3. setGeometry(200,200,500,300);
  4.  
  5. QMenuBar *menu = new QMenuBar(this);
  6. QPopupMenu *popup = new QPopupMenu(this);
  7. QToolBar *toolbar = new QToolBar();
  8. QToolButton *toolbutton = new QToolButton(QPixmap("fileopen"), "test","lszk",this,
  9. SLOT(wyjscie()),toolbar);
  10.  
  11. popup->insertItem("&ttt",this,SLOT(info()));
  12. menu->insertItem("&popup",popup);
  13. addToolBar(toolbar);
  14.  
  15. QListBox *lista = new QListBox(this);
  16. QPushButton *button = new QPushButton("ok",this);
  17. QPushButton *button2 = new QPushButton("anuluj",this);
  18. QVBoxLayout *pionowy = new QVBoxLayout(this);
  19. QHBoxLayout *poziomy = new QHBoxLayout(this);
  20.  
  21. for(int i=1;i<=10;++i)
  22. { QString string = QString("Element numer %1").arg(i);
  23. lista->insertItem(string); }
  24.  
  25. poziomy->addStretch();
  26. poziomy->addWidget(button);
  27. poziomy->addWidget(button2);
  28. pionowy->addWidget(lista);
  29. pionowy->addLayout(poziomy);
  30. //resize(200,150);
  31. }
To copy to clipboard, switch view to plain text mode