forked from qt-creator/qt-creator
QmlDesigner.formeEditor: add handler for context menu
This patch adds a handler for a context menu to AbstactFormEditorTool. Also all the tools are patched to ignore right mouse keys for now. The ResizeManipulator gets an active property. Change-Id: I66b247ce6ae8e9f88517a1c1698432fb64f70da7 Reviewed-on: http://codereview.qt.nokia.com/770 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Marco Bubke <marco.bubke@nokia.com>
This commit is contained in:
committed by
Marco Bubke
parent
a9f53ec9c5
commit
d7ed0667e9
@@ -202,6 +202,21 @@ static inline bool checkIfNodeIsAView(const ModelNode &node)
|
|||||||
node.metaInfo().isSubclassOf("QtQuick.PathView", -1, -1));
|
node.metaInfo().isSubclassOf("QtQuick.PathView", -1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractFormEditorTool::mousePressEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::RightButton) {
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractFormEditorTool::mouseReleaseEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::RightButton) {
|
||||||
|
showContextMenu(event);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
|
void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
FormEditorItem *formEditorItem = topFormEditorItem(itemList);
|
FormEditorItem *formEditorItem = topFormEditorItem(itemList);
|
||||||
@@ -218,4 +233,9 @@ void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractFormEditorTool::showContextMenu(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,11 +52,12 @@ public:
|
|||||||
virtual ~AbstractFormEditorTool();
|
virtual ~AbstractFormEditorTool();
|
||||||
|
|
||||||
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event) = 0;
|
QGraphicsSceneMouseEvent *event);
|
||||||
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event) = 0;
|
QGraphicsSceneMouseEvent *event) = 0;
|
||||||
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event) = 0;
|
QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
|
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event);
|
QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
@@ -97,6 +98,7 @@ protected:
|
|||||||
|
|
||||||
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
|
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
|
||||||
|
|
||||||
|
virtual void showContextMenu(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
FormEditorView *view() const;
|
FormEditorView *view() const;
|
||||||
FormEditorScene* scene() const;
|
FormEditorScene* scene() const;
|
||||||
|
|||||||
@@ -74,46 +74,52 @@ void MoveTool::clear()
|
|||||||
void MoveTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
void MoveTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (itemList.isEmpty())
|
if (event->button() == Qt::LeftButton) {
|
||||||
return;
|
if (itemList.isEmpty())
|
||||||
m_movingItems = movingItems(items());
|
return;
|
||||||
if (m_movingItems.isEmpty())
|
m_movingItems = movingItems(items());
|
||||||
return;
|
if (m_movingItems.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
m_moveManipulator.setItems(m_movingItems);
|
m_moveManipulator.setItems(m_movingItems);
|
||||||
m_moveManipulator.begin(event->scenePos());
|
m_moveManipulator.begin(event->scenePos());
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::mousePressEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_movingItems.isEmpty())
|
if (m_moveManipulator.isActive()) {
|
||||||
return;
|
if (m_movingItems.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
// m_selectionIndicator.hide();
|
// m_selectionIndicator.hide();
|
||||||
m_resizeIndicator.hide();
|
m_resizeIndicator.hide();
|
||||||
|
|
||||||
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
|
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
|
||||||
if (containerItem
|
if (containerItem
|
||||||
&& view()->currentState().isBaseState()) {
|
&& view()->currentState().isBaseState()) {
|
||||||
if (containerItem != m_movingItems.first()->parentItem()
|
if (containerItem != m_movingItems.first()->parentItem()
|
||||||
&& event->modifiers().testFlag(Qt::ShiftModifier)) {
|
&& event->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||||
m_moveManipulator.reparentTo(containerItem);
|
m_moveManipulator.reparentTo(containerItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool shouldSnapping = view()->widget()->snappingAction()->isChecked();
|
||||||
|
bool shouldSnappingAndAnchoring = view()->widget()->snappingAndAnchoringAction()->isChecked();
|
||||||
|
|
||||||
|
MoveManipulator::Snapping useSnapping = MoveManipulator::NoSnapping;
|
||||||
|
if (event->modifiers().testFlag(Qt::ControlModifier) != (shouldSnapping || shouldSnappingAndAnchoring)) {
|
||||||
|
if (shouldSnappingAndAnchoring)
|
||||||
|
useSnapping = MoveManipulator::UseSnappingAndAnchoring;
|
||||||
|
else
|
||||||
|
useSnapping = MoveManipulator::UseSnapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_moveManipulator.update(event->scenePos(), useSnapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldSnapping = view()->widget()->snappingAction()->isChecked();
|
|
||||||
bool shouldSnappingAndAnchoring = view()->widget()->snappingAndAnchoringAction()->isChecked();
|
|
||||||
|
|
||||||
MoveManipulator::Snapping useSnapping = MoveManipulator::NoSnapping;
|
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier) != (shouldSnapping || shouldSnappingAndAnchoring)) {
|
|
||||||
if (shouldSnappingAndAnchoring)
|
|
||||||
useSnapping = MoveManipulator::UseSnappingAndAnchoring;
|
|
||||||
else
|
|
||||||
useSnapping = MoveManipulator::UseSnapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_moveManipulator.update(event->scenePos(), useSnapping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
void MoveTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
@@ -195,31 +201,35 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
void MoveTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_movingItems.isEmpty())
|
if (m_moveManipulator.isActive()) {
|
||||||
return;
|
if (m_movingItems.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QLineF moveVector(event->scenePos(), m_moveManipulator.beginPoint());
|
QLineF moveVector(event->scenePos(), m_moveManipulator.beginPoint());
|
||||||
if (moveVector.length() < QApplication::startDragDistance())
|
if (moveVector.length() < QApplication::startDragDistance())
|
||||||
{
|
{
|
||||||
QPointF beginPoint(m_moveManipulator.beginPoint());
|
QPointF beginPoint(m_moveManipulator.beginPoint());
|
||||||
|
|
||||||
m_moveManipulator.end(beginPoint);
|
m_moveManipulator.end(beginPoint);
|
||||||
|
|
||||||
// m_selectionIndicator.show();
|
// m_selectionIndicator.show();
|
||||||
m_resizeIndicator.show();
|
m_resizeIndicator.show();
|
||||||
m_movingItems.clear();
|
m_movingItems.clear();
|
||||||
|
|
||||||
view()->changeToSelectionTool(event);
|
view()->changeToSelectionTool(event);
|
||||||
} else {
|
} else {
|
||||||
m_moveManipulator.end(event->scenePos());
|
m_moveManipulator.end(event->scenePos());
|
||||||
|
|
||||||
m_selectionIndicator.show();
|
m_selectionIndicator.show();
|
||||||
m_resizeIndicator.show();
|
m_resizeIndicator.show();
|
||||||
m_movingItems.clear();
|
m_movingItems.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::mouseReleaseEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
|
void MoveTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ ResizeManipulator::ResizeManipulator(LayerItem *layerItem, FormEditorView *view)
|
|||||||
m_beginRightMargin(0.0),
|
m_beginRightMargin(0.0),
|
||||||
m_beginBottomMargin(0.0),
|
m_beginBottomMargin(0.0),
|
||||||
m_layerItem(layerItem),
|
m_layerItem(layerItem),
|
||||||
m_resizeHandle(0)
|
m_resizeHandle(0),
|
||||||
|
m_isActive(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ void ResizeManipulator::removeHandle()
|
|||||||
void ResizeManipulator::begin(const QPointF &/*beginPoint*/)
|
void ResizeManipulator::begin(const QPointF &/*beginPoint*/)
|
||||||
{
|
{
|
||||||
if (m_resizeController.isValid()) {
|
if (m_resizeController.isValid()) {
|
||||||
|
m_isActive = true;
|
||||||
m_beginBoundingRect = m_resizeController.formEditorItem()->qmlItemNode().instanceBoundingRect();
|
m_beginBoundingRect = m_resizeController.formEditorItem()->qmlItemNode().instanceBoundingRect();
|
||||||
m_beginToSceneTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceSceneTransform();
|
m_beginToSceneTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceSceneTransform();
|
||||||
m_beginFromSceneTransform = m_beginToSceneTransform.inverted();
|
m_beginFromSceneTransform = m_beginToSceneTransform.inverted();
|
||||||
@@ -392,6 +394,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
|
|||||||
|
|
||||||
void ResizeManipulator::end()
|
void ResizeManipulator::end()
|
||||||
{
|
{
|
||||||
|
m_isActive = false;
|
||||||
m_rewriterTransaction.commit();
|
m_rewriterTransaction.commit();
|
||||||
clear();
|
clear();
|
||||||
removeHandle();
|
removeHandle();
|
||||||
@@ -508,6 +511,11 @@ void ResizeManipulator::clear()
|
|||||||
removeHandle();
|
removeHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ResizeManipulator::isActive() const
|
||||||
|
{
|
||||||
|
return m_isActive;
|
||||||
|
}
|
||||||
|
|
||||||
void ResizeManipulator::setSize(QmlItemNode itemNode, const QSizeF &size)
|
void ResizeManipulator::setSize(QmlItemNode itemNode, const QSizeF &size)
|
||||||
{
|
{
|
||||||
int penWidth = (itemNode.instancePenWidth() / 2) * 2;
|
int penWidth = (itemNode.instancePenWidth() / 2) * 2;
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
bool isActive() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isInvalidSize(const QSizeF & size);
|
bool isInvalidSize(const QSizeF & size);
|
||||||
void deleteSnapLines();
|
void deleteSnapLines();
|
||||||
@@ -91,6 +93,7 @@ private:
|
|||||||
QWeakPointer<LayerItem> m_layerItem;
|
QWeakPointer<LayerItem> m_layerItem;
|
||||||
ResizeHandleItem *m_resizeHandle;
|
ResizeHandleItem *m_resizeHandle;
|
||||||
RewriterTransaction m_rewriterTransaction;
|
RewriterTransaction m_rewriterTransaction;
|
||||||
|
bool m_isActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,32 +61,38 @@ ResizeTool::~ResizeTool()
|
|||||||
void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (itemList.isEmpty())
|
if (event->button() == Qt::LeftButton) {
|
||||||
return;
|
if (itemList.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
ResizeHandleItem *resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
ResizeHandleItem *resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
||||||
if (resizeHandle && resizeHandle->resizeController().isValid()) {
|
if (resizeHandle && resizeHandle->resizeController().isValid()) {
|
||||||
m_resizeManipulator.setHandle(resizeHandle);
|
m_resizeManipulator.setHandle(resizeHandle);
|
||||||
m_resizeManipulator.begin(event->scenePos());
|
m_resizeManipulator.begin(event->scenePos());
|
||||||
m_resizeIndicator.hide();
|
m_resizeIndicator.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::mousePressEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeTool::mouseMoveEvent(const QList<QGraphicsItem*> &,
|
void ResizeTool::mouseMoveEvent(const QList<QGraphicsItem*> &,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
bool shouldSnapping = view()->widget()->snappingAction()->isChecked();
|
if (m_resizeManipulator.isActive()) {
|
||||||
bool shouldSnappingAndAnchoring = view()->widget()->snappingAndAnchoringAction()->isChecked();
|
bool shouldSnapping = view()->widget()->snappingAction()->isChecked();
|
||||||
|
bool shouldSnappingAndAnchoring = view()->widget()->snappingAndAnchoringAction()->isChecked();
|
||||||
|
|
||||||
ResizeManipulator::Snapping useSnapping = ResizeManipulator::NoSnapping;
|
ResizeManipulator::Snapping useSnapping = ResizeManipulator::NoSnapping;
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier) != (shouldSnapping || shouldSnappingAndAnchoring)) {
|
if (event->modifiers().testFlag(Qt::ControlModifier) != (shouldSnapping || shouldSnappingAndAnchoring)) {
|
||||||
if (shouldSnappingAndAnchoring)
|
if (shouldSnappingAndAnchoring)
|
||||||
useSnapping = ResizeManipulator::UseSnappingAndAnchoring;
|
useSnapping = ResizeManipulator::UseSnappingAndAnchoring;
|
||||||
else
|
else
|
||||||
useSnapping = ResizeManipulator::UseSnapping;
|
useSnapping = ResizeManipulator::UseSnapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_resizeManipulator.update(event->scenePos(), useSnapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_resizeManipulator.update(event->scenePos(), useSnapping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
@@ -107,14 +113,18 @@ void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ResizeTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
void ResizeTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent * /*event*/)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (itemList.isEmpty())
|
if (m_resizeManipulator.isActive()) {
|
||||||
return;
|
if (itemList.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
m_selectionIndicator.show();
|
m_selectionIndicator.show();
|
||||||
m_resizeIndicator.show();
|
m_resizeIndicator.show();
|
||||||
m_resizeManipulator.end();
|
m_resizeManipulator.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::mouseReleaseEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/,
|
void ResizeTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> & /*itemList*/,
|
||||||
|
|||||||
@@ -67,21 +67,12 @@ SelectionTool::~SelectionTool()
|
|||||||
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
m_mousePressTimer.start();
|
if (event->button() == Qt::LeftButton) {
|
||||||
FormEditorItem* formEditorItem = topFormEditorItem(itemList);
|
m_mousePressTimer.start();
|
||||||
if (formEditorItem
|
FormEditorItem* formEditorItem = topFormEditorItem(itemList);
|
||||||
&& formEditorItem->qmlItemNode().isValid()
|
if (formEditorItem
|
||||||
&& !formEditorItem->qmlItemNode().hasChildren()) {
|
&& formEditorItem->qmlItemNode().isValid()
|
||||||
m_singleSelectionManipulator.begin(event->scenePos());
|
&& !formEditorItem->qmlItemNode().hasChildren()) {
|
||||||
|
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier))
|
|
||||||
m_singleSelectionManipulator.select(SingleSelectionManipulator::RemoveFromSelection, m_selectOnlyContentItems);
|
|
||||||
else if (event->modifiers().testFlag(Qt::ShiftModifier))
|
|
||||||
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
|
|
||||||
else
|
|
||||||
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);
|
|
||||||
} else {
|
|
||||||
if (event->modifiers().testFlag(Qt::AltModifier)) {
|
|
||||||
m_singleSelectionManipulator.begin(event->scenePos());
|
m_singleSelectionManipulator.begin(event->scenePos());
|
||||||
|
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier))
|
if (event->modifiers().testFlag(Qt::ControlModifier))
|
||||||
@@ -90,13 +81,25 @@ void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
|
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
|
||||||
else
|
else
|
||||||
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);
|
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);
|
||||||
|
|
||||||
m_singleSelectionManipulator.end(event->scenePos());
|
|
||||||
view()->changeToMoveTool(event->scenePos());
|
|
||||||
} else {
|
} else {
|
||||||
m_rubberbandSelectionManipulator.begin(event->scenePos());
|
if (event->modifiers().testFlag(Qt::AltModifier)) {
|
||||||
|
m_singleSelectionManipulator.begin(event->scenePos());
|
||||||
|
|
||||||
|
if (event->modifiers().testFlag(Qt::ControlModifier))
|
||||||
|
m_singleSelectionManipulator.select(SingleSelectionManipulator::RemoveFromSelection, m_selectOnlyContentItems);
|
||||||
|
else if (event->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
|
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
|
||||||
|
else
|
||||||
|
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);
|
||||||
|
|
||||||
|
m_singleSelectionManipulator.end(event->scenePos());
|
||||||
|
view()->changeToMoveTool(event->scenePos());
|
||||||
|
} else {
|
||||||
|
m_rubberbandSelectionManipulator.begin(event->scenePos());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AbstractFormEditorTool::mousePressEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTool::mouseMoveEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
void SelectionTool::mouseMoveEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
||||||
@@ -161,7 +164,7 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
scene()->highlightBoundingRect(topSelectableItem);
|
scene()->highlightBoundingRect(topSelectableItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_singleSelectionManipulator.isActive()) {
|
if (m_singleSelectionManipulator.isActive()) {
|
||||||
@@ -195,6 +198,7 @@ void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::mouseReleaseEvent(itemList, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent * event)
|
void SelectionTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent * event)
|
||||||
|
|||||||
Reference in New Issue
Block a user