diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 7d542ec31..ad202e9bb 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -608,6 +608,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons QPixmap pixmap(cursorResource); QCursor cur(pixmap, 2, 2); ui->view->viewport()->setCursor(cur); + ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor helpLabel->setText(toolTip); ui->view->setShowToolOptions(false); dialogTool = QSharedPointer(new Dialog(pattern, 0, this)); @@ -2315,7 +2316,9 @@ void MainWindow::ArrowTool(bool checked) emit EnableDetailHover(true); ui->view->AllowRubberBand(true); + ui->view->viewport()->unsetCursor(); ui->view->viewport()->setCursor(QCursor(Qt::ArrowCursor)); + ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor helpLabel->setText(""); ui->view->setShowToolOptions(true); qCDebug(vMainWindow, "Enabled arrow tool."); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index a741a79d2..9c70ed752 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -358,12 +358,14 @@ void VToolSinglePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) void VToolSinglePoint::AllowHover(bool enabled) { setAcceptHoverEvents(enabled); + AllowLabelHover(enabled); } //--------------------------------------------------------------------------------------------------------------------- void VToolSinglePoint::AllowSelecting(bool enabled) { setFlag(QGraphicsItem::ItemIsSelectable, enabled); + AllowLabelSelecting(enabled); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index ee75dc130..47b8d15ab 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -48,6 +48,7 @@ #include "global.h" #include "vscenepoint.h" #include "../vmisc/vmath.h" +#include "../vmisc/vabstractapplication.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -211,6 +212,11 @@ void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1); } + else + { + setCursor(qApp->getSceneView()->viewport()->cursor()); + } + this->setBrush(Qt::green); if(QGraphicsItem *parent = parentItem()) diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index 400bd7b1e..7597501e4 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -353,7 +353,8 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent) showToolOptions(true), isAllowRubberBand(true), m_ptStartPos(), - m_oldCursor() + m_oldCursor(), + m_currentCursor(Qt::ArrowCursor) { this->setResizeAnchor(QGraphicsView::AnchorUnderMouse); this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); @@ -486,6 +487,16 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VMainGraphicsView::mouseMoveEvent(QMouseEvent *event) { + // Hack to fix problem with mouse cursor. Looks like after we switch cursor back it is rewrited back by a dialog. + // Because no real way to catch this call we will check state for each move and compare to excpected state. + if (dragMode() != QGraphicsView::ScrollHandDrag && + // No way to restore bitmap from shape and we really don't need this for now. + m_currentCursor != Qt::BitmapCursor && + m_currentCursor != viewport()->cursor().shape()) + { + viewport()->setCursor(m_currentCursor); + } + if (dragMode() == QGraphicsView::ScrollHandDrag) { QScrollBar *hBar = horizontalScrollBar(); @@ -566,6 +577,12 @@ void VMainGraphicsView::EnsureVisibleWithDelay(const QGraphicsItem *item, unsign } } +//--------------------------------------------------------------------------------------------------------------------- +void VMainGraphicsView::setCurrentCursorShape() +{ + m_currentCursor = viewport()->cursor().shape(); +} + //--------------------------------------------------------------------------------------------------------------------- void VMainGraphicsView::setShowToolOptions(bool value) { diff --git a/src/libs/vwidgets/vmaingraphicsview.h b/src/libs/vwidgets/vmaingraphicsview.h index 9c51e0df4..c0c540798 100644 --- a/src/libs/vwidgets/vmaingraphicsview.h +++ b/src/libs/vwidgets/vmaingraphicsview.h @@ -129,6 +129,8 @@ public: static const unsigned long scrollDelay; + void setCurrentCursorShape(); + signals: /** * @brief MouseRelease help catch mouse release event. @@ -153,6 +155,7 @@ private: bool isAllowRubberBand; QPoint m_ptStartPos; QCursor m_oldCursor; + Qt::CursorShape m_currentCursor; }; #endif // VMAINGRAPHICSVIEW_H