- double handleSize = 6 / painter->matrix().m11();
- double halfHandleSize = handleSize / 2;
- painter->fillRect(-halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
- painter->fillRect(option->rect.width() - halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
- painter->fillRect(option->rect.width() - halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
- painter->fillRect(-halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+ QRectF handle(0, 0, 6, 6);
+ handle.moveTopLeft(r.topLeft());
+ painter->fillRect(handle, QColor(Qt::yellow));
+ handle.moveTopRight(r.topRight());
+ painter->fillRect(handle, QColor(Qt::yellow));
+ handle.moveBottomLeft(r.bottomLeft());
+ painter->fillRect(handle, QColor(Qt::yellow));
+ handle.moveBottomRight(r.bottomRight());
+ painter->fillRect(handle, QColor(Qt::yellow));
+ }
+
+ // Draw cross at center
+ QPointF center = r.center();
+ painter->drawLine(center + QPointF(-6, 0), center + QPointF(6, 0));
+ painter->drawLine(center + QPointF(0, 6), center + QPointF(0, -6));
+}
+
+bool OnMonitorRectItem::getView()
+{
+ if (m_view)
+ return true;
+
+ if (scene() && scene()->views().count()) {
+ m_view = scene()->views()[0];
+ return true;
+ } else {
+ return false;