PDA

View Full Version : QDock widget size



martinb0820
24th September 2008, 19:33
Can someone point me in a direction to do the following:

I have an Open Inventor render area in a QDockWidget. I'd like the size of the dock widget to be fixed when docked, but resizable when floating...

Can a layout in the main window do this?

Thanks,
Martin

martinb0820
11th December 2008, 17:47
In answer to my own question:


connect(
gui->dockWidget,
SIGNAL(topLevelChanged(bool)),
this,
SLOT(on_floatingChanged(bool)));

Then:


void Docking:: on_floatingChanged(bool floating)
{
QSize guiSize = gui->frameSize();
QSize dockSize = gui->dockWidget->frameSize();

dockSize = gui->dockWidget->frameSize();

if (floating)
{
int width = guiInitialSize.width() - dockWidgetInitialSize.width();
gui->resize(width, guiInitialSize.height());
}
else
{
gui->resize(guiInitialSize.width(), visGuiInitialSize.height());
}

guiSize = gui->frameSize();
dockSize = gui->dockWidget->frameSize();
dockSize = gui->dockWidget->frameSize();

} // on_floatingChanged