36 m_item->disconnect(
this);
39 connect(item, &QQuickItem::xChanged,
this, &Highlight::adjust);
40 connect(item, &QQuickItem::yChanged,
this, &Highlight::adjust);
41 connect(item, &QQuickItem::widthChanged,
this, &Highlight::adjust);
42 connect(item, &QQuickItem::heightChanged,
this, &Highlight::adjust);
43 connect(item, &QQuickItem::rotationChanged,
this, &Highlight::adjust);
44 connect(item, &QQuickItem::transformOriginChanged,
this, &Highlight::adjust);
46 QQuickWindow *view = item->window();
47 QQuickItem * contentItem = view->contentItem();
49 connect(contentItem, &QQuickItem::xChanged,
this, &Highlight::adjust);
50 connect(contentItem, &QQuickItem::yChanged,
this, &Highlight::adjust);
51 connect(contentItem, &QQuickItem::widthChanged,
this, &Highlight::adjust);
52 connect(contentItem, &QQuickItem::heightChanged,
this, &Highlight::adjust);
53 connect(contentItem, &QQuickItem::rotationChanged,
this, &Highlight::adjust);
54 connect(contentItem, &QQuickItem::transformOriginChanged,
this, &Highlight::adjust);
57 setContentsSize(view->size());
94 painter->setTransform(transform());
95 painter->setPen(QColor(108, 141, 221));
96 painter->drawRect(QRect(0, 0, item()->width() - 1, item()->height() - 1));
113 painter->fillRect(QRectF(0,0,contentsSize().width(), contentsSize().height()),
115 painter->setTransform(transform());
118 painter->setCompositionMode(QPainter::CompositionMode_Clear);
119 painter->fillRect(0, 0, item()->width(), item()->height(), Qt::black);
124 if (!m_nameDisplayActive)
128 QRect textRect = painter->boundingRect(QRect(10, contentsSize().height() - 10 ,
129 contentsSize().width() - 20, contentsSize().height()),
130 Qt::AlignCenter | Qt::ElideRight, m_name);
132 qreal xPosition = m_displayPoint.x();
133 if (xPosition + textRect.width() > contentsSize().width())
134 xPosition = contentsSize().width() - textRect.width();
137 textRect.setWidth(contentsSize().width());
139 qreal yPosition = m_displayPoint.y() - textRect.height() - 20;
143 painter->fillRect(QRectF(xPosition - 5, yPosition - 5,
144 textRect.width() + 10, textRect.height() + 10), Qt::gray);
145 painter->drawRect(QRectF(xPosition - 5, yPosition - 5,
146 textRect.width() + 10, textRect.height() + 10));
148 painter->drawStaticText(xPosition, yPosition, QStaticText(m_name));