@@ -240,16 +240,19 @@ void CDockWidgetTitleBar::mouseReleaseEvent(QMouseEvent* ev)
240
240
// End of tab moving, change order now
241
241
if (d->isDraggingState (DraggingTab) && d->DockArea )
242
242
{
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);
250
254
}
251
- qDebug () << " Move tab from " << fromIndex << " to " << toIndex;
252
- d->DockArea ->reorderDockWidget (fromIndex, toIndex);
255
+
253
256
}
254
257
255
258
if (!d->DragStartMousePosition .isNull ())
@@ -275,27 +278,35 @@ void CDockWidgetTitleBar::mouseMoveEvent(QMouseEvent* ev)
275
278
276
279
if (d->isDraggingState (DraggingFloatingWidget))
277
280
{
278
- d->FloatingWidget ->moveFloating ();
281
+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
282
+ d->FloatingWidget ->moveFloating ();
283
+ }
279
284
QFrame::mouseMoveEvent (ev);
280
285
return ;
281
286
}
282
287
283
288
// move tab
284
289
if (d->isDraggingState (DraggingTab))
285
290
{
286
- d->moveTab (ev);
291
+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
292
+ d->moveTab (ev);
293
+ }
287
294
}
288
295
289
296
bool MouseInsideTitleArea = d->titleAreaGeometryContains (ev->globalPos ());
290
297
if (!MouseInsideTitleArea)
291
298
{
292
- d->startFloating ();
299
+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
300
+ d->startFloating ();
301
+ }
293
302
return ;
294
303
}
295
304
else if (d->DockArea ->count () > 1
296
305
&& (ev->pos () - d->DragStartMousePosition ).manhattanLength () >= QApplication::startDragDistance ()) // Wait a few pixels before start moving
297
306
{
298
- d->DragState = DraggingTab;
307
+ if (d->DockWidget ->features () & CDockWidget::DockWidgetMovable) {
308
+ d->DragState = DraggingTab;
309
+ }
299
310
return ;
300
311
}
301
312
0 commit comments