Commit 999e60c6 authored by Florent D'Halluin's avatar Florent D'Halluin Committed by Guillaume Lazzara
Browse files

Update viewer.

* viewer/image_region.cc,
* viewer/image_region.hxx:
Improve selection highlighting (more readable).
parent d3888a39
...@@ -70,11 +70,10 @@ ImageRegion::paint(QPainter* painter, ...@@ -70,11 +70,10 @@ ImageRegion::paint(QPainter* painter,
width = 1; width = 1;
if (outline_) if (outline_)
painter->setPen(QPen(QBrush(color_), width)); painter->setPen(QPen(QBrush(color_), width, Qt::SolidLine,
Qt::SquareCap, Qt::MiterJoin));
else else
painter->setPen(QColor(0, 0, 0, 0)); painter->setPen(QColor(0, 0, 0, 0));
if (selected_)
painter->setPen(QPen(QBrush(QColor("red")), width));
QColor brush = color_; QColor brush = color_;
if (fill_) if (fill_)
...@@ -84,4 +83,40 @@ ImageRegion::paint(QPainter* painter, ...@@ -84,4 +83,40 @@ ImageRegion::paint(QPainter* painter,
painter->setBrush(brush); painter->setBrush(brush);
painter->drawPath(shape_); painter->drawPath(shape_);
if (selected_)
{
QPolygonF sceneRect = mapFromScene(scene()->sceneRect());
QPainterPath path;
path.addPolygon(sceneRect);
QColor brush(255, 255, 255);
brush.setAlpha(120);
painter->setBrush(brush);
painter->setPen(QColor(0, 0, 0, 0));
painter->drawPath(path.subtracted(shape_));
}
}
void
ImageRegion::select()
{
if (!selected_)
{
selected_ = true;
setZValue(2);
scene()->invalidate();
update();
}
}
void
ImageRegion::deselect()
{
if (selected_)
{
selected_ = false;
scene()->invalidate();
setZValue(1);
update();
}
} }
...@@ -87,28 +87,4 @@ ImageRegion::index() const ...@@ -87,28 +87,4 @@ ImageRegion::index() const
return index_; return index_;
} }
inline
void
ImageRegion::select()
{
if (!selected_)
{
selected_ = true;
setZValue(2);
update();
}
}
inline
void
ImageRegion::deselect()
{
if (selected_)
{
selected_ = false;
setZValue(1);
update();
}
}
#endif /* !IMAGE_REGION_HXX_ */ #endif /* !IMAGE_REGION_HXX_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment