@@ -240,19 +240,16 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
240240 // End of tab moving, change order now
241241 if (d->isDraggingState (DraggingTab) && d->DockArea )
242242 {
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);
254- }
255-
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 ;
250+ }
251+ qDebug () << " Move tab from " << fromIndex << " to " << toIndex;
252+ d->DockArea ->reorderDockWidget (fromIndex, toIndex);
256253 }
257254
258255 if (!d->DragStartMousePosition .isNull ())
@@ -276,37 +273,36 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
276273 return ;
277274 }
278275
276+ // move floating winwdow
279277 if (d->isDraggingState (DraggingFloatingWidget))
280278 {
281- if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
282- d->FloatingWidget ->moveFloating ();
283- }
279+ d->FloatingWidget ->moveFloating ();
284280 QFrame::mouseMoveEvent (ev);
285281 return ;
286282 }
287283
288284 // move tab
289285 if (d->isDraggingState (DraggingTab))
290286 {
291- if (d-> DockWidget -> features () & CDockWidget::DockWidgetMovable) {
292- d-> moveTab (ev);
293- }
287+ // Moving the tab is always allowed because it does not mean moving the
288+ // dock widget around
289+ d-> moveTab (ev);
294290 }
295291
296292 bool MouseInsideTitleArea = d->titleAreaGeometryContains (ev->globalPos ());
297293 if (!MouseInsideTitleArea)
298294 {
299- if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
295+ // Floating is only allowed for widgets that are movable
296+ if (d->DockWidget ->features ().testFlag (CDockWidget::DockWidgetMovable))
297+ {
300298 d->startFloating ();
301299 }
302300 return ;
303301 }
304302 else if (d->DockArea ->count () > 1
305303 && (ev->pos () - d->DragStartMousePosition ).manhattanLength () >= QApplication::startDragDistance ()) // Wait a few pixels before start moving
306304 {
307- if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
308- d->DragState = DraggingTab;
309- }
305+ d->DragState = DraggingTab;
310306 return ;
311307 }
312308
0 commit comments