PDA

View Full Version : Shrinking connection dialog



NoRulez
23rd April 2008, 19:43
Hey @all,

in my client application i have a connection dialog where i can enter the username, passwort, hostname, port. Now i will have an Advanced Button, and by clicking of them the four fields are shown. When i click once more on the button, the four fields must hide.

if have implement it as follows, (Drawings):


this->auth_dlg->layout()->setSizeConstraint(QLayout::SetFixedSize);

And in the slot for the Advanced Button I have:


if(this->is_advanced) {
this->is_advanced = false;
}
else if(!this->is_advanced) {
this->is_advanced = true;
}
auth_dlg_lServer->setVisible(this->is_advanced);
auth_dlg_lPort->setVisible(this->is_advanced);
auth_dlg_lUsername->setVisible(this->is_advanced);
auth_dlg_lPassword->setVisible(this->is_advanced);
auth_dlg_leServer->setVisible(this->is_advanced);
auth_dlg_lePort->setVisible(this->is_advanced);
auth_dlg_leUsername->setVisible(this->is_advanced);
auth_dlg_lePassword->setVisible(this->is_advanced);


So my problem now is when the fields are shown/hided, it takes a few seconds (1 - 3). How can i do it faster?

Regards
NoRulez

wysota
23rd April 2008, 19:59
Wrap all the extra widgets into a single widget (QWidget or QGroupBox, depending on the effect you want to obtain) and hide/show only this one widget. Oh... and you can do that using signals/slots connection - make the "Advanced" button checkable and connect its toggled(bool) signal to widget's setVisible(bool) slot.