Moved TabWidget grab animation to mouse press to match fancy docking behavior, fixed missed mouse up cursor restore

This commit is contained in:
sphrose
2021-04-21 10:19:12 +01:00
parent ffbd8ad665
commit bfa964a23e
2 changed files with 11 additions and 10 deletions
@@ -2003,11 +2003,6 @@ namespace AzQtComponents
clearDraggingState();
}
if (QApplication::overrideCursor())
{
QApplication::restoreOverrideCursor();
}
return true;
}
@@ -2385,11 +2380,6 @@ namespace AzQtComponents
*/
void FancyDocking::dropDockWidget(QDockWidget* dock, QWidget* onto, Qt::DockWidgetArea area)
{
if (QApplication::overrideCursor())
{
QApplication::restoreOverrideCursor();
}
// If the dock widget we are dropping is currently a tab, we need to retrieve it from
// the tab widget, and remove it as a tab. We also need to remove its item from our
// cache of widget <-> tab container since we are moving it somewhere else.
@@ -3573,6 +3563,11 @@ namespace AzQtComponents
*/
void FancyDocking::clearDraggingState()
{
if (QApplication::overrideCursor())
{
QApplication::restoreOverrideCursor();
}
m_ghostWidget->hide();
// Release the mouse and keyboard from our main window since we grab them when we start dragging
@@ -464,6 +464,11 @@ namespace AzQtComponents
{
if (mouseEvent->buttons() & Qt::LeftButton)
{
if (!QApplication::overrideCursor() || *QApplication::overrideCursor() != m_dragCursor)
{
QApplication::setOverrideCursor(m_dragCursor);
}
m_lastMousePress = mouseEvent->pos();
}
@@ -478,6 +483,7 @@ namespace AzQtComponents
// selected tab is moved around. The close button is not explicitly rendered for the
// moved tab during this operation. We need to make sure not to set it visible again
// while the tab is moving. This flag makes sure it happens.
m_movingTab = true;
}