diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 4261b0493..0a0a2ef99 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -1116,7 +1116,8 @@ QList MainWindowsNoGUI::CreateScenes(const QList scenes; for (int i=0; iSetNonInteractive(true); scene->setBackgroundBrush(QBrush(QColor(Qt::gray), Qt::SolidPattern)); scene->addItem(shadows.at(i)); scene->addItem(papers.at(i)); diff --git a/src/libs/vwidgets/vmaingraphicsscene.cpp b/src/libs/vwidgets/vmaingraphicsscene.cpp index 7300f1814..77a4f5752 100644 --- a/src/libs/vwidgets/vmaingraphicsscene.cpp +++ b/src/libs/vwidgets/vmaingraphicsscene.cpp @@ -113,6 +113,18 @@ void VMainGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsScene::mouseReleaseEvent(event); } +//--------------------------------------------------------------------------------------------------------------------- +bool VMainGraphicsScene::IsNonInteractive() const +{ + return m_nonInteractive; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMainGraphicsScene::SetNonInteractive(bool nonInteractive) +{ + m_nonInteractive = nonInteractive; +} + //--------------------------------------------------------------------------------------------------------------------- void VMainGraphicsScene::InitOrigins() { diff --git a/src/libs/vwidgets/vmaingraphicsscene.h b/src/libs/vwidgets/vmaingraphicsscene.h index 9a67ccf73..9a0fea035 100644 --- a/src/libs/vwidgets/vmaingraphicsscene.h +++ b/src/libs/vwidgets/vmaingraphicsscene.h @@ -63,6 +63,10 @@ public: QRectF VisibleItemsBoundingRect() const; void InitOrigins(); void SetOriginsVisible(bool visible); + + bool IsNonInteractive() const; + void SetNonInteractive(bool nonInteractive); + public slots: void ChoosedItem(quint32 id, const SceneObject &type); void SelectedItem(bool selected, quint32 object, quint32 tool); @@ -145,6 +149,7 @@ signals: void LanguageChanged(); private: + Q_DISABLE_COPY(VMainGraphicsScene) /** @brief horScrollBar value horizontal scroll bar. */ qint32 horScrollBar; @@ -155,6 +160,9 @@ private: QTransform _transform; QPointF scenePos; QVector origins; + + /** @brief m_nonInteractive all item on scene in non interactive. */ + bool m_nonInteractive{false}; }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index d35a2b97e..258388e66 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -568,9 +568,10 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *event) } case Qt::MiddleButton: { + auto scene = qobject_cast(this->scene()); const QList list = items(event->pos()); - if (list.size() == 0) - {// Only when the user clicks on the scene background + if (list.isEmpty() || (scene && scene->IsNonInteractive())) + {// Only when the user clicks on the scene background or non interactive scene m_ptStartPos = event->pos(); m_oldCursor = viewport()->cursor(); QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);