Hi, I'm trying to change grid layout in one of the GroupBoxes, where layout depends on option chosen in Combobox. Here is shortened version of my program. funcion AktualA should change layout in groupBox dane, but this works only with first change of Combobox. Thanks for help

nowywpis.h

Qt Code:
  1. #ifndef NOWYWPIS_H
  2. #define NOWYWPIS_H
  3. #include <QWidget>
  4. #include <QGridLayout>
  5. #include <QComboBox>
  6. QT_BEGIN_NAMESPACE
  7. class QGroupBox;
  8. class QComboBox;
  9. QT_END_NAMESPACE
  10.  
  11. class NowyWpis : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. NowyWpis(QWidget *parent = 0);
  16. private slots:
  17. void AktualA();
  18. void AktualT();
  19. private:
  20. void WyborT();
  21. QGroupBox *wybort;
  22. QGroupBox *dane;
  23. QComboBox *wybierzt;
  24. };
  25. #endif // NOWYWPIS_H
To copy to clipboard, switch view to plain text mode 

nowywpis.cpp
Qt Code:
  1. #include <QtGui>
  2. #include "nowywpis.h"
  3. NowyWpis::NowyWpis(QWidget *parent)
  4. : QWidget(parent)
  5. {
  6. WyborT();
  7. }
  8. void NowyWpis::WyborT()
  9. {
  10. QVBoxLayout *Layout = new QVBoxLayout;
  11. wybort = new QGroupBox(tr("Wybor T"));
  12. dane = new QGroupBox(tr("Dane"));
  13. QGridLayout *grid = new QGridLayout;
  14. wybierzt = new QComboBox;
  15. …
  16. connect(wybierzt, SIGNAL(currentIndexChanged(int)),
  17. this, SLOT(AktualT()));
  18. connect(wybierzt, SIGNAL(currentIndexChanged(int)),
  19. this, SLOT(AktualA()));
  20. …
  21. grid->addWidget(wybierzt, 0, 0);
  22. wybort->setLayout(grid);
  23. Layout->addWidget(wybort);
  24. Layout->addWidget(dane);
  25. setLayout(Layout);
  26. setWindowTitle(tr("Dodaj nowy wpis"));
  27. resize(800, 600);
  28. }
  29.  
  30. void NowyWpis::AktualT()
  31. {
  32. wybranyt =(wybierzt->currentText());
  33. }
  34.  
  35. void NowyWpis::AktualA()
  36. {
  37.  
  38. QGridLayout *siatka = new QGridLayout;
  39. …
  40. dane->setLayout(siatka);
  41. }
To copy to clipboard, switch view to plain text mode