forked from qt-creator/qt-creator
Change timing of the selection
Task-number: BAUHAUS-276
This commit is contained in:
@@ -41,6 +41,9 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
static const int s_startDragDistance = 20;
|
||||||
|
static const int s_startDragTime = 50;
|
||||||
|
|
||||||
SelectionTool::SelectionTool(FormEditorView *editorView)
|
SelectionTool::SelectionTool(FormEditorView *editorView)
|
||||||
: AbstractFormEditorTool(editorView),
|
: AbstractFormEditorTool(editorView),
|
||||||
m_rubberbandSelectionManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
|
m_rubberbandSelectionManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
|
||||||
@@ -95,16 +98,16 @@ void SelectionTool::mouseMoveEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
|||||||
{
|
{
|
||||||
if (m_singleSelectionManipulator.isActive()) {
|
if (m_singleSelectionManipulator.isActive()) {
|
||||||
QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->scenePos();
|
QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->scenePos();
|
||||||
if ((mouseMovementVector.toPoint().manhattanLength() > QApplication::startDragDistance())
|
if ((mouseMovementVector.toPoint().manhattanLength() > s_startDragDistance)
|
||||||
&& (m_mousePressTimer.elapsed() > QApplication::startDragTime())) {
|
&& (m_mousePressTimer.elapsed() > s_startDragTime)) {
|
||||||
m_singleSelectionManipulator.end(event->scenePos());
|
m_singleSelectionManipulator.end(event->scenePos());
|
||||||
view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint());
|
view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (m_rubberbandSelectionManipulator.isActive()) {
|
} else if (m_rubberbandSelectionManipulator.isActive()) {
|
||||||
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos();
|
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos();
|
||||||
if ((mouseMovementVector.toPoint().manhattanLength() > QApplication::startDragDistance())
|
if ((mouseMovementVector.toPoint().manhattanLength() > s_startDragDistance)
|
||||||
&& (m_mousePressTimer.elapsed() > QApplication::startDragTime())) {
|
&& (m_mousePressTimer.elapsed() > s_startDragTime)) {
|
||||||
m_rubberbandSelectionManipulator.update(event->scenePos());
|
m_rubberbandSelectionManipulator.update(event->scenePos());
|
||||||
|
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier))
|
if (event->modifiers().testFlag(Qt::ControlModifier))
|
||||||
@@ -142,7 +145,7 @@ void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &/*itemList*/,
|
|||||||
else if (m_rubberbandSelectionManipulator.isActive()) {
|
else if (m_rubberbandSelectionManipulator.isActive()) {
|
||||||
|
|
||||||
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos();
|
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos();
|
||||||
if (mouseMovementVector.toPoint().manhattanLength() < QApplication::startDragDistance()) {
|
if (mouseMovementVector.toPoint().manhattanLength() < s_startDragDistance) {
|
||||||
m_singleSelectionManipulator.begin(event->scenePos());
|
m_singleSelectionManipulator.begin(event->scenePos());
|
||||||
|
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier))
|
if (event->modifiers().testFlag(Qt::ControlModifier))
|
||||||
|
|||||||
Reference in New Issue
Block a user