Hello guys I have a problem ..
When I want to enter new parameters in the Qscroll area, put out from the new parameters and do not see the QscrollBar. I wish it were all dynamic, that when I post a new parameter, inserts it into the area by changing the bar ... how do I?? help!!

file .h
Qt Code:
  1. class ParamPage : public QWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. ParamPage(QWidget *parent = 0);
  6. QString text;
  7. QString prev;
  8. QLabel *label;
  9. QLineEdit *lineEdit;
  10. QPushButton *parButton;
  11. QPushButton *modButton;
  12. QLabel *pathLabel;
  13. QLineEdit *fileNameEdit;
  14. int num;
  15. QLineEdit *edit[10];
  16. int lineNumber;
  17. QStringList listFileData;
  18. QScrollArea *scrollArea;
  19. QRect desktopGeometry;
  20. void writeToFile();
  21. void reactToSIP();
  22.  
  23. private slots:
  24. void paramClicked();
  25. void modifClicked();
  26. void desktopResized(int screen);
  27.  
  28.  
  29. };
  30.  
  31.  
  32.  
  33. #endif
To copy to clipboard, switch view to plain text mode 



file .cpp
Qt Code:
  1. ParamPage::ParamPage(QWidget *parent)
  2. : QWidget(parent)
  3. {
  4.  
  5. desktopGeometry = QApplication::desktop()->availableGeometry(0);
  6. scrollArea = new QScrollArea(this);
  7.  
  8. QGroupBox *configGroup = new QGroupBox(scrollArea);
  9. QGridLayout *gridLayout = new QGridLayout(configGroup);
  10. configGroup->setLayout(gridLayout);
  11.  
  12. parButton = new QPushButton(configGroup);
  13. parButton->setText("new_par");
  14. modButton = new QPushButton(configGroup);
  15. modButton->setText("add par");
  16. pathLabel = new QLabel(configGroup);
  17. pathLabel->setText("File");
  18. fileNameEdit = new QLineEdit(configGroup);
  19. // QLabel *serverLabel = new QLabel(tr("Server:"));
  20.  
  21. //QComboBox *serverCombo = new QComboBox;
  22. //serverCombo->addItem(tr("Trolltech (Australia)"));
  23. //serverCombo->addItem(tr("Trolltech (Germany)"));
  24. //serverCombo->addItem(tr("Trolltech (Norway)"));
  25. //serverCombo->addItem(tr("Trolltech (People's Republic of China)"));
  26. //serverCombo->addItem(tr("Trolltech (USA)"));
  27. gridLayout->addWidget( parButton);
  28. gridLayout->addWidget(modButton);
  29. gridLayout->addWidget(pathLabel);
  30. gridLayout->addWidget(fileNameEdit);
  31.  
  32. scrollArea->setWidget(configGroup);
  33. QHBoxLayout* layout = new QHBoxLayout();
  34. layout->addWidget(scrollArea);
  35. setLayout(layout);
  36. scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  37.  
  38.  
  39.  
  40. //serverLayout->addWidget(serverCombo);
  41.  
  42. connect(parButton, SIGNAL (clicked()), this, SLOT( paramClicked()));
  43. connect(modButton, SIGNAL (clicked()), this, SLOT( modifClicked()));
  44.  
  45. connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
  46. this, SLOT(desktopResized(int)));
  47.  
  48.  
  49. }
  50.  
  51. void ParamPage::desktopResized(int screen)
  52. {
  53. if (screen != 0)
  54. return;
  55. reactToSIP();
  56. }
  57.  
  58. void ParamPage::reactToSIP()
  59. {
  60. QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
  61.  
  62. if (desktopGeometry != availableGeometry) {
  63. if (windowState() | Qt::WindowMaximized)
  64. setWindowState(windowState() & ~Qt::WindowMaximized);
  65.  
  66.  
  67.  
  68. setGeometry(availableGeometry);
  69. }
  70.  
  71. desktopGeometry = availableGeometry;
  72. }
  73.  
  74. void ParamPage::paramClicked(){
  75. bool ok;
  76. text = QInputDialog::getText(scrollArea, tr("Nuovo parametro"),
  77. tr("Nome parametro:"), QLineEdit::Normal,QDir::home().dirName(),
  78. &ok);
  79.  
  80. num = QInputDialog::getInteger(scrollArea, tr("Numero colonne"),tr("Percentage:"), 25, 0, 100, 1, &ok);
  81.  
  82. // QVBoxLayout *mainLayout = new QVBoxLayout;
  83.  
  84. // QLabel* l = new QLabel("new label", this);
  85. // mainLayout->addWidget(l,1,0);
  86. if(ok){
  87.  
  88. label = new QLabel(scrollArea);
  89. //label->adjustSize();
  90. //label->setIndent(15);
  91. //this->layout()->set
  92.  
  93. this->layout()->addWidget(label);
  94. label->setText(text);
  95. for(int i;i<num;i++){
  96. edit[i]=new QLineEdit(scrollArea);
  97. this->layout()->addWidget(edit[i]);
  98. }
  99.  
  100.  
  101. // mainLayout->addWidget(label,1,0);
  102.  
  103. // mainLayout->addWidget(label,3,0);
  104. // setLayout(mainLayout);
  105.  
  106. //lineEdit = new QLineEdit(this);
  107.  
  108. //lineEdit->set
  109. // this->layout()->addWidget(lineEdit);
  110.  
  111.  
  112.  
  113.  
  114. //layout()->addWidget(lineEdit);
  115. }
  116.  
  117.  
  118. }
  119.  
  120.  
  121. void ParamPage::modifClicked(){
  122. QString fileName =
  123. QFileDialog::getOpenFileName(this, tr("Open CFG File"),
  124. QDir::currentPath(),
  125. tr("CFG Files ( *.cfg)"));
  126. QFileInfo fileInfo(fileName);
  127.  
  128.  
  129. fileNameEdit->setText(fileInfo.absoluteFilePath());
  130. //pathValueLabel = new QLabel(fileInfo.fileName());
  131. // pathValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
  132.  
  133. QFile file(fileName);
  134. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  135. return ;
  136. QTextStream out(&file);
  137. prev="";
  138. lineNumber=0;
  139. while (!file.atEnd()) {
  140. QString line = file.readLine();
  141. listFileData.append(line);
  142. if(line.startsWith("Fine File")){
  143. //line=prev;
  144.  
  145. list = line.split(QRegExp("\\s+"));
  146. QString str;
  147. str.append("Exec ");
  148. str.append("/CODE/ScriptFiles/BatchModeRunning/");
  149. str.append("\n");
  150. str.append("Fine File");
  151. str.append(list[1]);
  152. listFileData.replace(lineNumber,str);
  153.  
  154.  
  155.  
  156. }
  157. // else{
  158. // prev= line;
  159. // }
  160. lineNumber ++;
  161. }
  162. writeToFile();
  163. }
  164.  
  165. void ParamPage::writeToFile(){
  166.  
  167. QFile file("Config_new.cfg");
  168. if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
  169. return;
  170.  
  171. QTextStream out(&file);
  172. for(int i = 0; i<listFileData.size(); i++)
  173. out << listFileData.at(i) << "\n";
  174. }
To copy to clipboard, switch view to plain text mode 

thankss!!!!