blob: b1e21e8eb6bef93fa5bcdc37db1738792d43a873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#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.setCosmetic(true);
painter->setPen(linePen);
painter->drawLine(m_bindingLine);
painter->restore();
}
QRectF BindingIndicatorGraphicsItem::boundingRect() const
{
return {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
|