31 #include <QtGui/QBrush> 32 #include <QGraphicsScene> 38 QGraphicsEllipseItem(kpt.pt.x-(kpt.size==0?3.0
f:kpt.size)/2.0
f, kpt.pt.y-(kpt.size==0?3.0
f:kpt.size)/2.0
f, kpt.size==0?3.0
f:kpt.size, kpt.size==0?3.0
f:kpt.size, parent),
45 this->setAcceptHoverEvents(
true);
46 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
57 this->setPen(QPen(color));
58 this->setBrush(QBrush(color));
67 if(qGray(pen().color().rgb() > 255/2))
73 _placeHolder->setBrush(QBrush(QColor ( 255, 255, 255, 170 )));
75 QGraphicsTextItem * text =
new QGraphicsTextItem(
_placeHolder);
76 text->setDefaultTextColor(this->pen().color().rgb());
79 text->setPlainText(QString(
"Id = %1\n" 89 text->setPlainText(QString(
"Id = %1\n" 106 QPen pen = this->pen();
107 this->setPen(QPen(pen.color(),
_width+2));
119 this->setPen(QPen(pen().color(),
_width));
124 QGraphicsScene * scene = this->scene();
125 if(scene && scene->focusItem() == 0)
131 this->setPen(QPen(pen().color(),
_width+2));
133 QGraphicsEllipseItem::hoverEnterEvent(event);
138 if(!this->hasFocus())
142 QGraphicsEllipseItem::hoverEnterEvent(event);
148 QGraphicsEllipseItem::focusInEvent(event);
154 QGraphicsEllipseItem::focusOutEvent(event);
void setColor(const QColor &color)
QGraphicsRectItem * _placeHolder
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
virtual void focusOutEvent(QFocusEvent *event)
KeypointItem(int id, const cv::KeyPoint &kpt, float depth=0, const QColor &color=Qt::green, QGraphicsItem *parent=0)
virtual void focusInEvent(QFocusEvent *event)
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
ULogger class and convenient macros.