forked from qt-creator/qt-creator
QmlDesigner: Add BindingIndicator
Change-Id: I46a763f87e19114e223b9eb897cbb89cf1f4c3d5 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -0,0 +1,191 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "bindingindicator.h"
|
||||||
|
|
||||||
|
#include "bindingindicatorgraphicsitem.h"
|
||||||
|
|
||||||
|
#include <QLineF>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
BindingIndicator::BindingIndicator(LayerItem *layerItem)
|
||||||
|
: m_layerItem(layerItem)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BindingIndicator::BindingIndicator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BindingIndicator::~BindingIndicator()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicator::show()
|
||||||
|
{
|
||||||
|
if (m_indicatorTopShape)
|
||||||
|
m_indicatorTopShape->show();
|
||||||
|
|
||||||
|
if (m_indicatorBottomShape)
|
||||||
|
m_indicatorBottomShape->show();
|
||||||
|
|
||||||
|
if (m_indicatorLeftShape)
|
||||||
|
m_indicatorLeftShape->show();
|
||||||
|
|
||||||
|
if (m_indicatorRightShape)
|
||||||
|
m_indicatorRightShape->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicator::hide()
|
||||||
|
{
|
||||||
|
if (m_indicatorTopShape)
|
||||||
|
m_indicatorTopShape->hide();
|
||||||
|
|
||||||
|
if (m_indicatorBottomShape)
|
||||||
|
m_indicatorBottomShape->hide();
|
||||||
|
|
||||||
|
if (m_indicatorLeftShape)
|
||||||
|
m_indicatorLeftShape->hide();
|
||||||
|
|
||||||
|
if (m_indicatorRightShape)
|
||||||
|
m_indicatorRightShape->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicator::clear()
|
||||||
|
{
|
||||||
|
delete m_indicatorTopShape;
|
||||||
|
delete m_indicatorBottomShape;
|
||||||
|
delete m_indicatorLeftShape;
|
||||||
|
delete m_indicatorRightShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF topLine(const QmlItemNode &qmlItemNode)
|
||||||
|
{
|
||||||
|
QRectF rectangle = qmlItemNode.instanceSceneTransform().mapRect(qmlItemNode.instanceBoundingRect()).adjusted(0, 1, 0, 0);
|
||||||
|
|
||||||
|
return QLineF(rectangle.topLeft(), rectangle.topRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF bottomLine(const QmlItemNode &qmlItemNode)
|
||||||
|
{
|
||||||
|
QRectF rectangle = qmlItemNode.instanceSceneTransform().mapRect(qmlItemNode.instanceBoundingRect());
|
||||||
|
|
||||||
|
return QLineF(rectangle.bottomLeft(), rectangle.bottomRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF leftLine(const QmlItemNode &qmlItemNode)
|
||||||
|
{
|
||||||
|
QRectF rectangle = qmlItemNode.instanceSceneTransform().mapRect(qmlItemNode.instanceBoundingRect()).adjusted(1, 0, 0, 0);
|
||||||
|
|
||||||
|
return QLineF(rectangle.topLeft(), rectangle.bottomLeft());
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF rightLine(const QmlItemNode &qmlItemNode)
|
||||||
|
{
|
||||||
|
QRectF rectangle = qmlItemNode.instanceSceneTransform().mapRect(qmlItemNode.instanceBoundingRect());
|
||||||
|
|
||||||
|
return QLineF(rectangle.topRight(), rectangle.bottomRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicator::setItems(const QList<FormEditorItem *> &itemList)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
|
if (itemList.count() == 1) {
|
||||||
|
m_formEditorItem = itemList.first();
|
||||||
|
QmlItemNode qmlItemNode = m_formEditorItem->qmlItemNode();
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("x")) {
|
||||||
|
m_indicatorTopShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorTopShape->updateBindingIndicator(leftLine(qmlItemNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("y")) {
|
||||||
|
m_indicatorLeftShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorLeftShape->updateBindingIndicator(topLine(qmlItemNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("width")) {
|
||||||
|
m_indicatorRightShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorRightShape->updateBindingIndicator(rightLine(qmlItemNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("height")) {
|
||||||
|
m_indicatorBottomShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorBottomShape->updateBindingIndicator(bottomLine(qmlItemNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicator::updateItems(const QList<FormEditorItem *> &itemList)
|
||||||
|
{
|
||||||
|
foreach (FormEditorItem *formEditorItem, itemList) {
|
||||||
|
if (formEditorItem == m_formEditorItem) {
|
||||||
|
QmlItemNode qmlItemNode = m_formEditorItem->qmlItemNode();
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("x")) {
|
||||||
|
if (m_indicatorTopShape.isNull())
|
||||||
|
m_indicatorTopShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorTopShape->updateBindingIndicator(leftLine(qmlItemNode));
|
||||||
|
} else {
|
||||||
|
delete m_indicatorTopShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("y")) {
|
||||||
|
if (m_indicatorLeftShape.isNull())
|
||||||
|
m_indicatorLeftShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorLeftShape->updateBindingIndicator(topLine(qmlItemNode));
|
||||||
|
} else {
|
||||||
|
delete m_indicatorLeftShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("width")) {
|
||||||
|
if (m_indicatorRightShape.isNull())
|
||||||
|
m_indicatorRightShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorRightShape->updateBindingIndicator(rightLine(qmlItemNode));
|
||||||
|
} else {
|
||||||
|
delete m_indicatorRightShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qmlItemNode.hasBindingProperty("height")) {
|
||||||
|
if (m_indicatorBottomShape.isNull())
|
||||||
|
m_indicatorBottomShape = new BindingIndicatorGraphicsItem(m_layerItem.data());
|
||||||
|
m_indicatorBottomShape->updateBindingIndicator(bottomLine(qmlItemNode));
|
||||||
|
} else {
|
||||||
|
delete m_indicatorBottomShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QMLDESIGNER_BINDINGINDICATOR_H
|
||||||
|
#define QMLDESIGNER_BINDINGINDICATOR_H
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include "layeritem.h"
|
||||||
|
#include "formeditoritem.h"
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class FormEditorItem;
|
||||||
|
class BindingIndicatorGraphicsItem;
|
||||||
|
|
||||||
|
class BindingIndicator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BindingIndicator(LayerItem *layerItem);
|
||||||
|
BindingIndicator();
|
||||||
|
~BindingIndicator();
|
||||||
|
|
||||||
|
void show();
|
||||||
|
void hide();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
void setItems(const QList<FormEditorItem*> &itemList);
|
||||||
|
void updateItems(const QList<FormEditorItem*> &itemList);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<LayerItem> m_layerItem;
|
||||||
|
QPointer<FormEditorItem> m_formEditorItem;
|
||||||
|
QPointer<BindingIndicatorGraphicsItem> m_indicatorTopShape;
|
||||||
|
QPointer<BindingIndicatorGraphicsItem> m_indicatorBottomShape;
|
||||||
|
QPointer<BindingIndicatorGraphicsItem> m_indicatorLeftShape;
|
||||||
|
QPointer<BindingIndicatorGraphicsItem> m_indicatorRightShape;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
#endif // QMLDESIGNER_BINDINGINDICATOR_H
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "bindingindicatorgraphicsitem.h"
|
||||||
|
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
BindingIndicatorGraphicsItem::BindingIndicatorGraphicsItem(QGraphicsItem *parent) :
|
||||||
|
QGraphicsObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicatorGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
QPen linePen(QColor(255, 0, 0, 255), 2);
|
||||||
|
//linePen.setDashPattern(QVector<double>() << 3. << 2.);
|
||||||
|
painter->setPen(linePen);
|
||||||
|
painter->drawLine(m_bindingLine);
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF BindingIndicatorGraphicsItem::boundingRect() const
|
||||||
|
{
|
||||||
|
return QRectF(m_bindingLine.x1(),
|
||||||
|
m_bindingLine.y1(),
|
||||||
|
m_bindingLine.x2() - m_bindingLine.x1() + 3,
|
||||||
|
m_bindingLine.y2() - m_bindingLine.y1() + 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindingIndicatorGraphicsItem::updateBindingIndicator(const QLineF &bindingLine)
|
||||||
|
{
|
||||||
|
m_bindingLine = bindingLine;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QMLDESIGNER_BINDINGINDICATORGRAPHICSITEM_H
|
||||||
|
#define QMLDESIGNER_BINDINGINDICATORGRAPHICSITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsObject>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class BindingIndicatorGraphicsItem : public QGraphicsObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BindingIndicatorGraphicsItem(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
QRectF boundingRect() const;
|
||||||
|
|
||||||
|
void updateBindingIndicator(const QLineF &bindingLine);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLineF m_bindingLine;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
#endif // QMLDESIGNER_BINDINGINDICATORGRAPHICSITEM_H
|
||||||
@@ -32,7 +32,9 @@ SOURCES += formeditoritem.cpp \
|
|||||||
lineeditaction.cpp \
|
lineeditaction.cpp \
|
||||||
abstractcustomtool.cpp \
|
abstractcustomtool.cpp \
|
||||||
anchorindicator.cpp \
|
anchorindicator.cpp \
|
||||||
components/formeditor/anchorindicatorgraphicsitem.cpp
|
anchorindicatorgraphicsitem.cpp \
|
||||||
|
bindingindicator.cpp \
|
||||||
|
bindingindicatorgraphicsitem.cpp
|
||||||
HEADERS += formeditorscene.h \
|
HEADERS += formeditorscene.h \
|
||||||
formeditorwidget.h \
|
formeditorwidget.h \
|
||||||
formeditoritem.h \
|
formeditoritem.h \
|
||||||
@@ -66,5 +68,7 @@ HEADERS += formeditorscene.h \
|
|||||||
lineeditaction.h \
|
lineeditaction.h \
|
||||||
abstractcustomtool.h \
|
abstractcustomtool.h \
|
||||||
anchorindicator.h \
|
anchorindicator.h \
|
||||||
components/formeditor/anchorindicatorgraphicsitem.h
|
anchorindicatorgraphicsitem.h \
|
||||||
|
bindingindicator.h \
|
||||||
|
bindingindicatorgraphicsitem.h
|
||||||
RESOURCES += formeditor.qrc
|
RESOURCES += formeditor.qrc
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ MoveTool::MoveTool(FormEditorView *editorView)
|
|||||||
m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
|
m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
|
||||||
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
|
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
m_resizeIndicator(editorView->scene()->manipulatorLayerItem()),
|
m_resizeIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
m_anchorIndicator(editorView->scene()->manipulatorLayerItem())
|
m_anchorIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
|
m_bindingIndicator(editorView->scene()->manipulatorLayerItem())
|
||||||
{
|
{
|
||||||
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
|
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
|
||||||
}
|
}
|
||||||
@@ -65,6 +66,7 @@ void MoveTool::clear()
|
|||||||
m_selectionIndicator.clear();
|
m_selectionIndicator.clear();
|
||||||
m_resizeIndicator.clear();
|
m_resizeIndicator.clear();
|
||||||
m_anchorIndicator.clear();
|
m_anchorIndicator.clear();
|
||||||
|
m_bindingIndicator.clear();
|
||||||
|
|
||||||
AbstractFormEditorTool::clear();
|
AbstractFormEditorTool::clear();
|
||||||
}
|
}
|
||||||
@@ -96,6 +98,7 @@ void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
// m_selectionIndicator.hide();
|
// m_selectionIndicator.hide();
|
||||||
m_resizeIndicator.hide();
|
m_resizeIndicator.hide();
|
||||||
m_anchorIndicator.hide();
|
m_anchorIndicator.hide();
|
||||||
|
m_bindingIndicator.hide();
|
||||||
|
|
||||||
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
|
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
|
||||||
if (containerItem && view()->currentState().isBaseState()) {
|
if (containerItem && view()->currentState().isBaseState()) {
|
||||||
@@ -154,6 +157,7 @@ void MoveTool::keyPressEvent(QKeyEvent *event)
|
|||||||
// m_selectionIndicator.hide();
|
// m_selectionIndicator.hide();
|
||||||
m_resizeIndicator.hide();
|
m_resizeIndicator.hide();
|
||||||
m_anchorIndicator.hide();
|
m_anchorIndicator.hide();
|
||||||
|
m_bindingIndicator.hide();
|
||||||
m_moveManipulator.beginRewriterTransaction();
|
m_moveManipulator.beginRewriterTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +191,7 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
|
|||||||
// m_selectionIndicator.show();
|
// m_selectionIndicator.show();
|
||||||
m_resizeIndicator.show();
|
m_resizeIndicator.show();
|
||||||
m_anchorIndicator.show();
|
m_anchorIndicator.show();
|
||||||
|
m_bindingIndicator.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +217,7 @@ void MoveTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
m_selectionIndicator.show();
|
m_selectionIndicator.show();
|
||||||
m_resizeIndicator.show();
|
m_resizeIndicator.show();
|
||||||
m_anchorIndicator.show();
|
m_anchorIndicator.show();
|
||||||
|
m_bindingIndicator.show();
|
||||||
m_movingItems.clear();
|
m_movingItems.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,6 +240,7 @@ void MoveTool::selectedItemsChanged(const QList<FormEditorItem*> &itemList)
|
|||||||
m_selectionIndicator.setItems(movingItems(itemList));
|
m_selectionIndicator.setItems(movingItems(itemList));
|
||||||
m_resizeIndicator.setItems(itemList);
|
m_resizeIndicator.setItems(itemList);
|
||||||
m_anchorIndicator.setItems(itemList);
|
m_anchorIndicator.setItems(itemList);
|
||||||
|
m_bindingIndicator.setItems(itemList);
|
||||||
updateMoveManipulator();
|
updateMoveManipulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,6 +390,7 @@ void MoveTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
|||||||
m_selectionIndicator.updateItems(itemList);
|
m_selectionIndicator.updateItems(itemList);
|
||||||
m_resizeIndicator.updateItems(itemList);
|
m_resizeIndicator.updateItems(itemList);
|
||||||
m_anchorIndicator.updateItems(itemList);
|
m_anchorIndicator.updateItems(itemList);
|
||||||
|
m_bindingIndicator.updateItems(itemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "selectionindicator.h"
|
#include "selectionindicator.h"
|
||||||
#include "resizeindicator.h"
|
#include "resizeindicator.h"
|
||||||
#include "anchorindicator.h"
|
#include "anchorindicator.h"
|
||||||
|
#include "bindingindicator.h"
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -95,6 +96,7 @@ private:
|
|||||||
SelectionIndicator m_selectionIndicator;
|
SelectionIndicator m_selectionIndicator;
|
||||||
ResizeIndicator m_resizeIndicator;
|
ResizeIndicator m_resizeIndicator;
|
||||||
AnchorIndicator m_anchorIndicator;
|
AnchorIndicator m_anchorIndicator;
|
||||||
|
BindingIndicator m_bindingIndicator;
|
||||||
QList<FormEditorItem*> m_movingItems;
|
QList<FormEditorItem*> m_movingItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ SelectionTool::SelectionTool(FormEditorView *editorView)
|
|||||||
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
|
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
m_resizeIndicator(editorView->scene()->manipulatorLayerItem()),
|
m_resizeIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
m_anchorIndicator(editorView->scene()->manipulatorLayerItem()),
|
m_anchorIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
|
m_bindingIndicator(editorView->scene()->manipulatorLayerItem()),
|
||||||
m_selectOnlyContentItems(false)
|
m_selectOnlyContentItems(false)
|
||||||
{
|
{
|
||||||
m_selectionIndicator.setCursor(Qt::ArrowCursor);
|
m_selectionIndicator.setCursor(Qt::ArrowCursor);
|
||||||
@@ -260,6 +261,7 @@ void SelectionTool::clear()
|
|||||||
m_selectionIndicator.clear();
|
m_selectionIndicator.clear();
|
||||||
m_resizeIndicator.clear();
|
m_resizeIndicator.clear();
|
||||||
m_anchorIndicator.clear();
|
m_anchorIndicator.clear();
|
||||||
|
m_bindingIndicator.clear();
|
||||||
|
|
||||||
AbstractFormEditorTool::clear();
|
AbstractFormEditorTool::clear();
|
||||||
}
|
}
|
||||||
@@ -269,6 +271,7 @@ void SelectionTool::selectedItemsChanged(const QList<FormEditorItem*> &itemList)
|
|||||||
m_selectionIndicator.setItems(itemList);
|
m_selectionIndicator.setItems(itemList);
|
||||||
m_resizeIndicator.setItems(itemList);
|
m_resizeIndicator.setItems(itemList);
|
||||||
m_anchorIndicator.setItems(itemList);
|
m_anchorIndicator.setItems(itemList);
|
||||||
|
m_bindingIndicator.setItems(itemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
|
||||||
@@ -276,6 +279,7 @@ void SelectionTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemLis
|
|||||||
m_selectionIndicator.updateItems(itemList);
|
m_selectionIndicator.updateItems(itemList);
|
||||||
m_resizeIndicator.updateItems(itemList);
|
m_resizeIndicator.updateItems(itemList);
|
||||||
m_anchorIndicator.updateItems(itemList);
|
m_anchorIndicator.updateItems(itemList);
|
||||||
|
m_bindingIndicator.updateItems(itemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
|
void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "selectionindicator.h"
|
#include "selectionindicator.h"
|
||||||
#include "resizeindicator.h"
|
#include "resizeindicator.h"
|
||||||
#include "anchorindicator.h"
|
#include "anchorindicator.h"
|
||||||
|
#include "bindingindicator.h"
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ private:
|
|||||||
SelectionIndicator m_selectionIndicator;
|
SelectionIndicator m_selectionIndicator;
|
||||||
ResizeIndicator m_resizeIndicator;
|
ResizeIndicator m_resizeIndicator;
|
||||||
AnchorIndicator m_anchorIndicator;
|
AnchorIndicator m_anchorIndicator;
|
||||||
|
BindingIndicator m_bindingIndicator;
|
||||||
QTime m_mousePressTimer;
|
QTime m_mousePressTimer;
|
||||||
bool m_selectOnlyContentItems;
|
bool m_selectOnlyContentItems;
|
||||||
QCursor m_cursor;
|
QCursor m_cursor;
|
||||||
|
|||||||
Reference in New Issue
Block a user