blob: 06ddf382e7c9c55865bb2d0929463313b7de6639 (
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
40
|
// 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 "controlelement.h"
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include "layeritem.h"
#include <QDebug>
namespace QmlDesigner {
ControlElement::ControlElement(LayerItem *layerItem)
: m_controlShape(new QGraphicsRectItem(layerItem))
{
QPen pen;
pen.setCosmetic(true);
pen.setStyle(Qt::DashLine);
pen.setColor(Qt::blue);
m_controlShape->setPen(pen);
}
ControlElement::~ControlElement()
{
delete m_controlShape;
}
void ControlElement::hide()
{
m_controlShape->hide();
}
void ControlElement::setBoundingRect(const QRectF &rect)
{
m_controlShape->show();
m_controlShape->setRect(m_controlShape->mapFromScene(rect).boundingRect());
}
}
|