View Full Version : making an application window non resizable
aegis
13th May 2007, 16:49
I have a QDialog that i would like to make non resisable...
how can i do it?
N.A
dialog->layout()->setSizeConstraint(QLayout::SetFixedSize);
marcel
13th May 2007, 16:52
Use either setFixedSize( sizeHint() ), or ( better ) QLayout::setSizeConstraint( QLayout::SetFixedSize ).
The later will allow resizing if system dimensions change ( font sizes, etc ).
But to use it, your layout design must have no errors.
Regards
aegis
13th May 2007, 17:02
what is the name of the layout?? i take the gui from qt designer, i have a grid layout.What is it's name?
marcel
13th May 2007, 17:05
It does not have a name.
You can access it via the layout() function, as jpn said.
aegis
13th May 2007, 17:22
dialog->layout()->setSizeConstraint(QLayout::SetFixedSize);
if write this, i get this error "expected primary expression before '->' token
any ideas?
wysota
13th May 2007, 17:26
Substitute "dialog" with your variable containing a pointer to the dialog in question. And next time please use the search facilities before asking questions which you suspect may have already been answered.
marcel
13th May 2007, 17:45
You can call this from the constructor of your dialog:
layout()->setSizeConstraint( QLayout::SetFixedSize );
aegis
13th May 2007, 18:44
You can call this from the constructor of your dialog:
layout()->setSizeConstraint( QLayout::SetFixedSize );
the problem is that with this option, it compiles and then when i try to run it it throws a runtime exception:(
Sounds like layout() returns 0, which means you haven't installed a top level layout on the dialog. If you're using Designer, deselect all the child widgets, open up context menu over the background of the dialog form, select "Layout->...". In another words, a layout dragged from the widget box is not installed on the dialog but is a "floating layout".
marcel
13th May 2007, 18:46
What is the exception?
This most likely is because your layout design is not correct.
Do you have a layout set in your dialog at all?
What about setFixedSize( sizeHint() )?
Could you post some relevant code?
aegis
13th May 2007, 18:51
What is the exception?
This most likely is because your layout design is not correct.
Do you have a layout set in your dialog at all?
What about setFixedSize( sizeHint() )?
Could you post some relevant code?
error 400 run time exception. I have done my layout design with qdesigner....how can it be wrong?
which part you want posted?
ippalosGui::ippalosGui(QWidget* parent):QDialog(parent),ippalos()
{
setupUi(this);
heapSort_RadioButton->setChecked(true);
sortingOptionsGroupBox->setVisible(false);
processButton->setEnabled(false);
//sortingOptionsGroupBox->hide();
//settingsGroupBox->hide();
settingsPushButton->setChecked(false);
//layout()->setSizeConstraint(QLayout::SetFixedSize); //making the dialog non-resizable by the user
createActions();
createMenu();
//lineEditEditedText->setText("Constructor...");
//all connects happen inside the cnstuctor...
//connect radio buttons... toggled()
connect(measureButton, SIGNAL(clicked()), this, SLOT(doTakeMeasurements()));
//connect(processButton, SIGNAL(clicked()), processButton, SLOT(showMenu()));
connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
}
aegis
13th May 2007, 18:56
this is y ui file...
marcel
13th May 2007, 18:56
If you'd post the UI it would be better.
Also, where do you call layout()->setSizeConstraint?
marcel
13th May 2007, 18:59
OK.
You didn't set a top level layout as jpn said. That is why it gave you the exception.
Try the one I attached.
regards
aegis
13th May 2007, 19:10
OK.
You didn't set a top level layout as jpn said. That is why it gave you the exception.
Try the one I attached.
regards
thanks for your reply. You saved me cause i have to deliver by tomorow... but i have some more general questions that i want to ask you!
marcel
13th May 2007, 19:14
Go ahead and post them...
If not me, I'm sure the guys will be able to answer.
Regards
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.