qwidget how to set visible/hidden ?
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 :
Code:
...
bigEditor
->setPlainText
(QDir::currentPath ());
bigEditor
->setFont
(QFont("Courier",
15,
QFont::Bold));
quitButton->setDefault(true);
moreButton->setCheckable(true);
moreButton->setAutoDefault(false);
connect(moreButton, SIGNAL(clicked()), this, SLOT(Visualizza()));
connect(quitButton, SIGNAL(clicked()), this, SLOT(accept()));
extensionLayout->setMargin(10);
extensionLayout->addWidget(bigEditor);
extension->setLayout(extensionLayout);
extension->hide();
mainLayout->addWidget(horizontalGroupBox);
mainLayout->addWidget(buttonBox);
mainLayout->addWidget(extension);
setLayout(mainLayout);
....
void Dialog::Visualizza()
{
bool stato = extension->isHidden();
bigEditor->append( "VISUALIZZATO" );
switch (stato)
{
case true:
extension->show();
bigEditor->setVisible(true);
case false:
extension->hide();
bigEditor->setVisible(false);
}
}
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.
Re: qwidget how to set visible/hidden ?
man this is really fun ..
use "break" in switch and your code work properly ... :)
Code:
case true:
printf("the true state returning:%d \n", stato);
extension->show();
bigEditor->setVisible(true);
break;
case false:
printf("false the state returning:%d \n", stato);
extension->hide();
bigEditor->setVisible(false);
break;
Re: qwidget how to set visible/hidden ?
SOLVED, I've use a member isHidden().
Re: qwidget how to set visible/hidden ?
wagmare, tks for you help. I've just solved....
with if condition.
By Ricky
Re: qwidget how to set visible/hidden ?
How about just:
Code:
bool state = extension->isHidden();
extension->setVisible(state);
bigEditor->setVisible(state);
You don't need any conditions then.