PDA

View Full Version : Prevent docking on doubleclick



yartov
24th June 2008, 20:36
Hello,
Could somebody tell me how I can prevent docking action on mouse doubleclick on title bar. I create my dockable widget as follow:


QDockWidget* d = new QDockWidget(tr("myDockWidget"), this);
d->setAllowedAreas(Qt::NoDockWidgetArea);
d->setFeatures ( QDockWidget::DockWidgetFloatable|QDockWidget::Dock WidgetMovable|QDockWidget::DockWidgetClosable );
myView = new SplitCombineFiles( d );
d->setWidget(myView );
d->setFloating ( true );
i would think that i set all flags possible to prevent docking, but no, it still docks on double click.
Thanks in advance.

marcel
24th June 2008, 21:01
You can install an event filter on the dock's title bar widget (available with QDockWidget::titleBarWidget (http://doc.trolltech.com/latest/qdockwidget.html#titleBarWidget)) and ignore any two consecutive mouse press events that appear within QApplication::doubleClickInterval.

See QObject::installEventFilter (http://doc.trolltech.com/latest/qobject.html#installEventFilter).

yartov
24th June 2008, 21:41
What do you mean by "install". I would appreciate sample code.

yartov
24th June 2008, 21:46
Never mind, I found sample code. Thanks a lot. Good suggestion.