You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, July 15th 2010, 3:05pm

Resize of main window without setFixedSize

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

Junior

Professional

  • "Junior" is male

Posts: 1,613

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

2

Thursday, July 15th 2010, 8:36pm

I'm not sure what you are wanting based on the information provided.
You have a mainwindow that contains a widget in which you want to hide/show based on a button.
Do you have a layout you use with mainwindow to add and remove the widget from?
Do you set the centralWidget on mainwindow with a different widget?
What is suppose to resize: the widget or mainwindow to the size of the widget?
Sorry - need more information on your design to help you on this.