Skip to content
Snippets Groups Projects
Commit 50b09f96 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Adjusted behaviour of rubber band in the case of connection being established.

parent 7bbcbec3
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,10 @@ DesignerScene::DesignerScene(QObject *parent)
setSceneRect(QRectF(-800, 0, 1600, 1600));
setBackgroundBrush(DesignerHelper::getSceneBackground());
NodeEditor *nodeEditor = new NodeEditor(parent);
nodeEditor->install(this);
connect(nodeEditor, SIGNAL(connectionIsEstablished(NodeEditorConnection*)), this, SLOT(onEstablishedConnection(NodeEditorConnection*)));
m_nodeEditor = new NodeEditor(parent);
m_nodeEditor->install(this);
connect(m_nodeEditor, SIGNAL(connectionIsEstablished(NodeEditorConnection*)), this, SLOT(onEstablishedConnection(NodeEditorConnection*)));
connect(m_nodeEditor, SIGNAL(selectionModeChangeRequest(int)), this, SIGNAL(selectionModeChangeRequest(int)));
connect(this, SIGNAL(selectionChanged()), this, SLOT(onSceneSelectionChanged()));
}
......
......@@ -15,6 +15,7 @@ class QItemSelection;
class NodeEditorConnection;
class DesignerMimeData;
class SampleViewAligner;
class NodeEditor;
//! Main class which represents SessionModel on graphics scene
......@@ -34,6 +35,11 @@ public:
IView *getViewForItem(ParameterizedItem *item) { return m_ItemToView[item]; }
NodeEditor *getNodeEditor() { return m_nodeEditor;}
signals:
void selectionModeChangeRequest(int);
public slots:
void onSceneSelectionChanged();
void onSessionSelectionChanged(const QItemSelection &, const QItemSelection &);
......@@ -83,6 +89,8 @@ private:
//!< foreground line representing appropriate interface during lauer's movement
SampleViewAligner *m_aligner;
NodeEditor *m_nodeEditor;
};
......
#include "NodeEditor.h"
#include "NodeEditorPort.h"
#include "NodeEditorConnection.h"
#include "DesignerView.h"
#include <QGraphicsScene>
#include <QEvent>
#include <QGraphicsSceneMouseEvent>
......@@ -47,6 +48,7 @@ bool NodeEditor::eventFilter(QObject *o, QEvent *e)
QGraphicsItem *item = itemAt(me->scenePos());
if (item && item->type() == NodeEditorPort::Type)
{
emit selectionModeChangeRequest(DesignerView::SimpleSelectionMode);
conn = new NodeEditorConnection(0, scene);
conn->setPort1((NodeEditorPort*) item);
conn->setPos1(item->scenePos());
......@@ -73,6 +75,8 @@ bool NodeEditor::eventFilter(QObject *o, QEvent *e)
{
if (conn && me->button() == Qt::LeftButton)
{
emit selectionModeChangeRequest(DesignerView::RubberSelectionMode);
QGraphicsItem *item = itemAt(me->scenePos());
if (item && item->type() == NodeEditorPort::Type)
{
......
......@@ -29,6 +29,7 @@ public:
bool eventFilter(QObject *, QEvent *);
signals:
void selectionModeChangeRequest(int);
void connectionIsEstablished(NodeEditorConnection *);
private:
......
......@@ -130,7 +130,8 @@ SampleToolBar::SampleToolBar(QWidget *parent)
void SampleToolBar::onViewSelectionMode(int mode)
{
qDebug() << "SampleToolBar::onViewSelectionMode" << mode;
m_pointerModeGroup->button(mode)->setChecked(true);
if(mode == DesignerView::RubberSelectionMode || mode == DesignerView::HandDragMode)
m_pointerModeGroup->button(mode)->setChecked(true);
}
void SampleToolBar::onScaleComboChanged(const QString &scale_string)
......
......@@ -229,6 +229,8 @@ void SampleView::connectSignals()
connect(m_toolBar, SIGNAL(zoomIn()),
m_sampleDesigner->getView(), SLOT(zoomIn()));
connect(m_sampleDesigner->getScene(), SIGNAL(selectionModeChangeRequest(int)), m_sampleDesigner->getView(), SLOT(onSelectionMode(int)));
// connect context menu for tree view
connect(m_tree_view, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showContextMenu(const QPoint &)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment