Hi everybody.
My question is this :
I've a dialog, with buttons and a textedit. I want to set visible/hidden the textedit. The code is this :
Qt Code:
  1. ...
  2. bigEditor = new QTextEdit;
  3. bigEditor->setPlainText(QDir::currentPath ());
  4. bigEditor->setFont(QFont("Courier", 15, QFont::Bold));
  5.  
  6. quitButton = new QPushButton(tr("&Quit"));
  7. quitButton->setDefault(true);
  8.  
  9. moreButton = new QPushButton(tr("&More"));
  10. moreButton->setCheckable(true);
  11. moreButton->setAutoDefault(false);
  12.  
  13. buttonBox = new QDialogButtonBox(Qt::Horizontal);
  14. buttonBox->addButton(quitButton, QDialogButtonBox::ActionRole);
  15. buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
  16.  
  17. connect(moreButton, SIGNAL(clicked()), this, SLOT(Visualizza()));
  18. connect(quitButton, SIGNAL(clicked()), this, SLOT(accept()));
  19.  
  20. extension = new QWidget;
  21. QVBoxLayout *extensionLayout = new QVBoxLayout;
  22. extensionLayout->setMargin(10);
  23. extensionLayout->addWidget(bigEditor);
  24. extension->setLayout(extensionLayout);
  25. extension->hide();
  26.  
  27. QVBoxLayout *mainLayout = new QVBoxLayout;
  28. mainLayout->addWidget(horizontalGroupBox);
  29. mainLayout->addWidget(buttonBox);
  30. mainLayout->addWidget(extension);
  31. setLayout(mainLayout);
  32.  
  33. ....
  34. void Dialog::Visualizza()
  35. {
  36. bool stato = extension->isHidden();
  37. bigEditor->append( "VISUALIZZATO" );
  38. switch (stato)
  39. {
  40. case true:
  41. extension->show();
  42. bigEditor->setVisible(true);
  43. case false:
  44. extension->hide();
  45. bigEditor->setVisible(false);
  46. }
  47. }
To copy to clipboard, switch view to plain text mode 
I've posted only the code I tks is important the last code it's for making the rest of Dialog. If is intresting I can post it.