diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp index 76df971108..bc8da127a6 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp @@ -159,6 +159,8 @@ namespace AzQtComponents // Timer for updating our hovered drop zone opacity QObject::connect(m_dropZoneHoverFadeInTimer, &QTimer::timeout, this, &FancyDocking::onDropZoneHoverFadeInUpdate); m_dropZoneHoverFadeInTimer->setInterval(g_FancyDockingConstants.dropZoneHoverFadeUpdateIntervalMS); + QIcon dragIcon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg")); + m_dragCursor = QCursor(dragIcon.pixmap(32), 10, 5); } FancyDocking::~FancyDocking() @@ -1884,6 +1886,8 @@ namespace AzQtComponents return; } + QApplication::setOverrideCursor(m_dragCursor); + QPoint relativePressPos = pressPos; // If we are dragging a floating window, we need to grab a reference to its @@ -1999,6 +2003,11 @@ namespace AzQtComponents clearDraggingState(); } + if (QApplication::overrideCursor()) + { + QApplication::restoreOverrideCursor(); + } + return true; } @@ -2376,6 +2385,11 @@ 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. diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h index a466ce7087..20b90ad25c 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h @@ -266,6 +266,8 @@ namespace AzQtComponents QString m_floatingWindowIdentifierPrefix; QString m_tabContainerIdentifierPrefix; + + QCursor m_dragCursor; }; } // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp index 895785f47b..121f35db61 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -419,6 +420,14 @@ namespace AzQtComponents // a mouse move. The paint handler updates the close button's visibility setAttribute(Qt::WA_Hover); AzQtComponents::Style::addClass(this, g_emptyStyleClass); + + QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab_release.svg")); + m_hoverCursor = QCursor(icon.pixmap(32), 10, 5); + + icon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg")); + m_dragCursor = QCursor(icon.pixmap(32), 10, 5); + + this->setCursor(m_hoverCursor); } void TabBar::setHandleOverflow(bool handleOverflow) @@ -479,6 +488,13 @@ namespace AzQtComponents void TabBar::mouseReleaseEvent(QMouseEvent* mouseEvent) { + // Ensure we don't reset the cursor in the case of a dummy event being sent from DockTabWidget to trigger the animation. + Qt::MouseButtons realButtons = QApplication::mouseButtons(); + if (QApplication::overrideCursor() && !(realButtons & Qt::LeftButton)) + { + QApplication::restoreOverrideCursor(); + } + if (m_movingTab && !(mouseEvent->buttons() & Qt::LeftButton)) { // When a moving tab is released, there is a short animation to put the moving tab @@ -632,13 +648,7 @@ namespace AzQtComponents { QPoint p = tabRect(i).topLeft(); - int rightPadding = g_closeButtonPadding; - if (m_overflowing == Overflowing) - { - rightPadding = 0; - } - - p.setX(p.x() + tabRect(i).width() - rightPadding - g_closeButtonWidth); + p.setX(p.x() + tabRect(i).width() - g_closeButtonPadding - g_closeButtonWidth); p.setY(p.y() + 1 + (tabRect(i).height() - g_closeButtonWidth) / 2); tabBtn->move(p); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h index 3f12f79907..e86deef7b4 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h @@ -203,6 +203,9 @@ namespace AzQtComponents bool m_movingTab = false; QPoint m_lastMousePress; + QCursor m_dragCursor; + QCursor m_hoverCursor; + void resetOverflow(); void overflowIfNeeded(); void showCloseButtonAt(int index); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg new file mode 100644 index 0000000000..c0da9b802f --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg new file mode 100644 index 0000000000..e70be77d51 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc index f9e601fb6d..048758c283 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc @@ -636,5 +636,7 @@ img/UI20/Cursors/Pointer.svg + img/UI20/Cursors/Grab_release.svg + img/UI20/Cursors/Grabbing.svg