File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
488
488
489
489
// uncomment the following line if you want to use opaque undocking and
490
490
// opaque splitter resizing
491
- // CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
491
+ // CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
492
492
493
493
// uncomment the following line if you want a fixed tab width that does
494
494
// not change if the visibility of the close button changes
Original file line number Diff line number Diff line change @@ -215,6 +215,8 @@ void DockWidgetTabPrivate::moveTab(QMouseEvent* ev)
215
215
QPoint Distance = ev->globalPos () - GlobalDragStartMousePosition;
216
216
Distance.setY (0 );
217
217
auto TargetPos = Distance + TabDragStartPosition;
218
+ TargetPos.rx () = qMax (TargetPos.x (), 0 );
219
+ TargetPos.rx () = qMin (_this->parentWidget ()->rect ().right () - _this->width () + 1 , TargetPos.rx ());
218
220
_this->move (TargetPos);
219
221
_this->raise ();
220
222
}
@@ -357,19 +359,18 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
357
359
}
358
360
359
361
// move tab
360
- bool TabOutsideBar = false ;
361
362
if (d->isDraggingState (DraggingTab))
362
363
{
363
364
// Moving the tab is always allowed because it does not mean moving the
364
365
// dock widget around
365
366
d->moveTab (ev);
366
- TabOutsideBar = (geometry ().right () < 0 ) || (geometry ().left () > parentWidget ()->rect ().right ());
367
367
}
368
368
369
-
369
+ auto MappedPos = mapToParent (ev->pos ());
370
+ bool MouseOutsideBar = (MappedPos.x () < 0 ) || (MappedPos.x () > parentWidget ()->rect ().right ());
370
371
// Maybe a fixed drag distance is better here ?
371
372
int DragDistanceY = qAbs (d->GlobalDragStartMousePosition .y () - ev->globalPos ().y ());
372
- if (DragDistanceY >= CDockManager::startDragDistance () || TabOutsideBar )
373
+ if (DragDistanceY >= CDockManager::startDragDistance () || MouseOutsideBar )
373
374
{
374
375
// If this is the last dock area in a dock container with only
375
376
// one single dock widget it does not make sense to move it to a new
You can’t perform that action at this time.
0 commit comments