PDA

View Full Version : QDockWidget moves out of screen



Randulf
29th May 2007, 11:09
Hi!
I have an application with some dockwidgets that are floating, i.e they cannot be docked.
Every dock has a widget with some buttons and other things in it that is attached to the dock.
Example:

void CreateInfoDock(const QString &name, QWidget *parent)
{
infoDock = new QDockWidget(name, parent);
infoDock->setFloating (true);
infoDock->setAllowedAreas(false);
infoDock->setMinimumHeight(150);
infoDock->setMaximumHeight(170);
infoDock->setMinimumWidth(250);
infoDock->setMaximumWidth(300);

infoDockWidget = new InfoDockWidget(infoDock);
infoDock->setWidget( infoDockWidget );
}

Now, what happends is that if I want to move the dock and by accident press the mouse on the boarder of the dock so it resizes it can suddenly move very fast out of the screen.
This is really annoying since I can't get it back without recompiling the program with a ->move(int x, int y) command.
Is there some way that i can disable the resize function so this can't happen?
//Nils

marcel
29th May 2007, 11:12
Yes, I've noticed this too with tool windows.
You can make it not resizable with setFixedSize( sizeHint ), or if you have a top layout in it the use QLayout::setSizeConstraint( QLayout::SetFixedSize ).
The latter is preferred.

Regards

Randulf
29th May 2007, 11:22
Yes, I've noticed this too with tool windows.
You can make it not resizable with setFixedSize( sizeHint ), or if you have a top layout in it the use QLayout::setSizeConstraint( QLayout::SetFixedSize ).
The latter is preferred.

Regards

Yes, I have tried with setFixedSize(sizeHint) and it didnt work.

Will try the other.
Thanks

marcel
29th May 2007, 11:30
Try setting the flags Qt::Tool if you want to use setFixedSize.

Regards