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) :
488488
489489 // uncomment the following line if you want to use opaque undocking and
490490 // opaque splitter resizing
491- // CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
491+ // CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
492492
493493 // uncomment the following line if you want a fixed tab width that does
494494 // 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)
215215 QPoint Distance = ev->globalPos () - GlobalDragStartMousePosition;
216216 Distance.setY (0 );
217217 auto TargetPos = Distance + TabDragStartPosition;
218+ TargetPos.rx () = qMax (TargetPos.x (), 0 );
219+ TargetPos.rx () = qMin (_this->parentWidget ()->rect ().right () - _this->width () + 1 , TargetPos.rx ());
218220 _this->move (TargetPos);
219221 _this->raise ();
220222}
@@ -357,19 +359,18 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
357359 }
358360
359361 // move tab
360- bool TabOutsideBar = false ;
361362 if (d->isDraggingState (DraggingTab))
362363 {
363364 // Moving the tab is always allowed because it does not mean moving the
364365 // dock widget around
365366 d->moveTab (ev);
366- TabOutsideBar = (geometry ().right () < 0 ) || (geometry ().left () > parentWidget ()->rect ().right ());
367367 }
368368
369-
369+ auto MappedPos = mapToParent (ev->pos ());
370+ bool MouseOutsideBar = (MappedPos.x () < 0 ) || (MappedPos.x () > parentWidget ()->rect ().right ());
370371 // Maybe a fixed drag distance is better here ?
371372 int DragDistanceY = qAbs (d->GlobalDragStartMousePosition .y () - ev->globalPos ().y ());
372- if (DragDistanceY >= CDockManager::startDragDistance () || TabOutsideBar )
373+ if (DragDistanceY >= CDockManager::startDragDistance () || MouseOutsideBar )
373374 {
374375 // If this is the last dock area in a dock container with only
375376 // 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