37 m_item->disconnect(
this);
40 connect(item, &QQuickItem::xChanged,
this, &Highlight::adjust);
41 connect(item, &QQuickItem::yChanged,
this, &Highlight::adjust);
42 connect(item, &QQuickItem::widthChanged,
this, &Highlight::adjust);
43 connect(item, &QQuickItem::heightChanged,
this, &Highlight::adjust);
44 connect(item, &QQuickItem::rotationChanged,
this, &Highlight::adjust);
45 connect(item, &QQuickItem::transformOriginChanged,
this, &Highlight::adjust);
47 QQuickWindow *view = item->window();
48 QQuickItem * contentItem = view->contentItem();
50 connect(contentItem, &QQuickItem::xChanged,
this, &Highlight::adjust);
51 connect(contentItem, &QQuickItem::yChanged,
this, &Highlight::adjust);
52 connect(contentItem, &QQuickItem::widthChanged,
this, &Highlight::adjust);
53 connect(contentItem, &QQuickItem::heightChanged,
this, &Highlight::adjust);
54 connect(contentItem, &QQuickItem::rotationChanged,
this, &Highlight::adjust);
55 connect(contentItem, &QQuickItem::transformOriginChanged,
this, &Highlight::adjust);
58 setContentsSize(view->size());
95 painter->setTransform(transform());
96 painter->setPen(QColor(108, 141, 221));
97 painter->drawRect(QRect(0, 0, item()->width() - 1, item()->height() - 1));
114 painter->fillRect(QRectF(0,0,contentsSize().width(), contentsSize().height()),
116 painter->setTransform(transform());
119 painter->setCompositionMode(QPainter::CompositionMode_Clear);
120 painter->fillRect(0, 0, item()->width(), item()->height(), Qt::black);
125 if (!m_nameDisplayActive)
129 QRect textRect = painter->boundingRect(QRect(10, contentsSize().height() - 10 ,
130 contentsSize().width() - 20, contentsSize().height()),
131 Qt::AlignCenter | Qt::ElideRight, m_name);
133 qreal xPosition = m_displayPoint.x();
134 if (xPosition + textRect.width() > contentsSize().width())
135 xPosition = contentsSize().width() - textRect.width();
138 textRect.setWidth(contentsSize().width());
140 qreal yPosition = m_displayPoint.y() - textRect.height() - 20;
144 painter->fillRect(QRectF(xPosition - 5, yPosition - 5,
145 textRect.width() + 10, textRect.height() + 10), Qt::gray);
146 painter->drawRect(QRectF(xPosition - 5, yPosition - 5,
147 textRect.width() + 10, textRect.height() + 10));
149 painter->drawStaticText(xPosition, yPosition, QStaticText(m_name));