PDA

View Full Version : Resize of main window without setFixedSize



ElyBeta
15th July 2010, 14:35
S.O.: Ubuntu 9.10
Qt 4.6.2

Hello,
I have a problem about window resize after click of button that shows/hides widget in the main window.
When I want to hide the window on click of button main window don't becomeagain little .

I can' t use setFixedSize, setMaximumSize because I want resize (maximize/minimize with mouse) the window.
I have tested resize method but it doesn' t work. In MainWindow:


connect(myWidget, SIGNAL(buttonShowToggled(bool)),this, SLOT(showOtherWidget(bool)));

void MainWindow::showOtherWidget(bool isVisible) {

if(isVisible== true){
otherWidget->show();
resize( QSize(width()+50,height()));
} else {
otherWidget->hide();
//rightLayout->removeWidget(otherWidget);
resize( QSize(width()-50,height()));
}
}



Could anybody please give me indications about solution or possibly indicate me examples ?

Thanks in advance
Ely

Lykurg
15th July 2010, 14:41
Hi, the trick is to use QLayout::setSizeConstraint() with QLayout::SetFixedSize. See the article Expanding dialog in our wiki!

ElyBeta
15th July 2010, 15:09
Thanks

but i can' t use setFixedSize because I want resize (maximize/minimize with mouse) the window.