@@ -240,16 +240,19 @@ void CDockWidgetTitleBar::mouseReleaseEvent(QMouseEvent* ev)
240240 // End of tab moving, change order now
241241 if (d->isDraggingState (DraggingTab) && d->DockArea )
242242 {
243- // Find tab under mouse
244- QPoint pos = d->DockArea ->mapFromGlobal (ev->globalPos ());
245- int fromIndex = d->DockArea ->tabIndex (d->DockWidget );
246- int toIndex = d->DockArea ->indexOfContentByTitlePos (pos, this );
247- if (-1 == toIndex)
248- {
249- toIndex = d->DockArea ->count () - 1 ;
243+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
244+ // Find tab under mouse
245+ QPoint pos = d->DockArea ->mapFromGlobal (ev->globalPos ());
246+ int fromIndex = d->DockArea ->tabIndex (d->DockWidget );
247+ int toIndex = d->DockArea ->indexOfContentByTitlePos (pos, this );
248+ if (-1 == toIndex)
249+ {
250+ toIndex = d->DockArea ->count () - 1 ;
251+ }
252+ qDebug () << " Move tab from " << fromIndex << " to " << toIndex;
253+ d->DockArea ->reorderDockWidget (fromIndex, toIndex);
250254 }
251- qDebug () << " Move tab from " << fromIndex << " to " << toIndex;
252- d->DockArea ->reorderDockWidget (fromIndex, toIndex);
255+
253256 }
254257
255258 if (!d->DragStartMousePosition .isNull ())
@@ -275,27 +278,35 @@ void CDockWidgetTitleBar::mouseMoveEvent(QMouseEvent* ev)
275278
276279 if (d->isDraggingState (DraggingFloatingWidget))
277280 {
278- d->FloatingWidget ->moveFloating ();
281+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
282+ d->FloatingWidget ->moveFloating ();
283+ }
279284 QFrame::mouseMoveEvent (ev);
280285 return ;
281286 }
282287
283288 // move tab
284289 if (d->isDraggingState (DraggingTab))
285290 {
286- d->moveTab (ev);
291+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
292+ d->moveTab (ev);
293+ }
287294 }
288295
289296 bool MouseInsideTitleArea = d->titleAreaGeometryContains (ev->globalPos ());
290297 if (!MouseInsideTitleArea)
291298 {
292- d->startFloating ();
299+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
300+ d->startFloating ();
301+ }
293302 return ;
294303 }
295304 else if (d->DockArea ->count () > 1
296305 && (ev->pos () - d->DragStartMousePosition ).manhattanLength () >= QApplication::startDragDistance ()) // Wait a few pixels before start moving
297306 {
298- d->DragState = DraggingTab;
307+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
308+ d->DragState = DraggingTab;
309+ }
299310 return ;
300311 }
301312
0 commit comments