[TD]Fix selection highlight for QGIPrimPath children
This commit is contained in:
@@ -43,8 +43,8 @@ using namespace TechDrawGui;
|
||||
QGIPrimPath::QGIPrimPath():
|
||||
m_width(0),
|
||||
m_capStyle(Qt::RoundCap),
|
||||
m_fill(Qt::NoBrush)
|
||||
// m_fill(Qt::SolidPattern)
|
||||
m_fillStyleCurrent (Qt::NoBrush)
|
||||
// m_fillStyleCurrent (Qt::SolidPattern)
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
@@ -67,14 +67,11 @@ QGIPrimPath::QGIPrimPath():
|
||||
m_styleDef = Qt::NoBrush;
|
||||
m_styleSelect = Qt::SolidPattern;
|
||||
m_styleNormal = m_styleDef;
|
||||
m_fillStyleCurrent = m_styleNormal;
|
||||
|
||||
m_colDefFill = Qt::white;
|
||||
// m_colDefFill = Qt::transparent;
|
||||
m_fillStyle = m_styleDef;
|
||||
m_fill = m_styleDef;
|
||||
m_colNormalFill = m_colDefFill;
|
||||
m_brush.setStyle(m_styleDef);
|
||||
m_brush.setColor(m_colDefFill);
|
||||
setFillColor(m_colDefFill);
|
||||
|
||||
setPrettyNormal();
|
||||
}
|
||||
@@ -94,6 +91,7 @@ QVariant QGIPrimPath::itemChange(GraphicsItemChange change, const QVariant &valu
|
||||
|
||||
void QGIPrimPath::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
// Base::Console().Message("QGIPP::hoverEnter() - selected; %d\n",isSelected());
|
||||
if (!isSelected()) {
|
||||
setPrettyPre();
|
||||
}
|
||||
@@ -102,9 +100,11 @@ void QGIPrimPath::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
void QGIPrimPath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
// Base::Console().Message("QGIPP::hoverLeave() - selected; %d\n",isSelected());
|
||||
if(!isSelected()) {
|
||||
setPrettyNormal();
|
||||
}
|
||||
|
||||
QGraphicsPathItem::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
@@ -120,22 +120,21 @@ void QGIPrimPath::setHighlighted(bool b)
|
||||
}
|
||||
|
||||
void QGIPrimPath::setPrettyNormal() {
|
||||
// Base::Console().Message("QGIPP::setPrettyNormal()\n");
|
||||
m_colCurrent = m_colNormal;
|
||||
m_fillColor = m_colNormalFill;
|
||||
// m_colCurrent = getNormalColor();
|
||||
update();
|
||||
m_fillColorCurrent = m_colNormalFill;
|
||||
}
|
||||
|
||||
void QGIPrimPath::setPrettyPre() {
|
||||
// Base::Console().Message("QGIPP::setPrettyPre()\n");
|
||||
m_colCurrent = getPreColor();
|
||||
m_fillColor = getPreColor();
|
||||
update();
|
||||
m_fillColorCurrent = getPreColor();
|
||||
}
|
||||
|
||||
void QGIPrimPath::setPrettySel() {
|
||||
// Base::Console().Message("QGIPP::setPrettySel()\n");
|
||||
m_colCurrent = getSelectColor();
|
||||
m_fillColor = getSelectColor();
|
||||
update();
|
||||
m_fillColorCurrent = getSelectColor();
|
||||
}
|
||||
|
||||
//wf: why would a face use it's parent's normal colour?
|
||||
@@ -286,25 +285,26 @@ void QGIPrimPath::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
void QGIPrimPath::setFill(QColor c, Qt::BrushStyle s) {
|
||||
setFillColor(c);
|
||||
m_styleNormal = s;
|
||||
m_fill = s;
|
||||
m_fillStyleCurrent = s;
|
||||
}
|
||||
|
||||
void QGIPrimPath::setFill(QBrush b) {
|
||||
setFillColor(b.color());
|
||||
m_styleNormal = b.style();
|
||||
m_fill = b.style();
|
||||
m_fillStyleCurrent = b.style();
|
||||
}
|
||||
|
||||
void QGIPrimPath::resetFill() {
|
||||
m_colNormalFill = m_colDefFill;
|
||||
m_styleNormal = m_styleDef;
|
||||
m_fill = m_styleDef;
|
||||
m_fillStyleCurrent = m_styleDef;
|
||||
}
|
||||
|
||||
//set PlainFill
|
||||
void QGIPrimPath::setFillColor(QColor c)
|
||||
{
|
||||
m_colNormalFill = c;
|
||||
m_colDefFill = c;
|
||||
// m_colDefFill = c;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,8 +317,8 @@ void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
m_pen.setStyle(m_styleCurrent);
|
||||
setPen(m_pen);
|
||||
|
||||
m_brush.setColor(m_colNormalFill);
|
||||
m_brush.setStyle(m_fill);
|
||||
m_brush.setColor(m_fillColorCurrent);
|
||||
m_brush.setStyle(m_fillStyleCurrent);
|
||||
setBrush(m_brush);
|
||||
|
||||
QGraphicsPathItem::paint (painter, &myOption, widget);
|
||||
|
||||
Reference in New Issue
Block a user