|
@@ -2,47 +2,85 @@
|
|
|
|
|
|
#include <QPen>
|
|
|
|
|
|
-CPathItem::CPathItem(QGraphicsItem *parent) : QGraphicsPathItem(parent) { }
|
|
|
+CPathItem::CPathItem(QGraphicsItem *parent) : QGraphicsPathItem(parent)
|
|
|
+{
|
|
|
+ useCustomSettings();
|
|
|
+}
|
|
|
|
|
|
int CPathItem::lineWidth() const
|
|
|
{
|
|
|
- QPen pen = this->pen();
|
|
|
- return pen.width();
|
|
|
+ return m_lineWidth;
|
|
|
}
|
|
|
|
|
|
-void CPathItem::setLineWidth(int width)
|
|
|
+void CPathItem::setLineWidth(int w)
|
|
|
{
|
|
|
- QPen pen = this->pen();
|
|
|
- pen.setWidth(width);
|
|
|
- setPen(pen);
|
|
|
+ m_lineWidth = w;
|
|
|
+ useCustomSettings();
|
|
|
}
|
|
|
|
|
|
-QColor CPathItem::lineColor() const
|
|
|
+QColor CPathItem::normaLineColor() const
|
|
|
{
|
|
|
- QPen pen = this->pen();
|
|
|
- return pen.color();
|
|
|
+ return m_normalLineColor;
|
|
|
}
|
|
|
|
|
|
-void CPathItem::setLineColor(QColor color)
|
|
|
+void CPathItem::setNormalLineColor(QColor c)
|
|
|
{
|
|
|
- QPen pen = this->pen();
|
|
|
- pen.setColor(color);
|
|
|
- setPen(pen);
|
|
|
+ m_normalLineColor = c;
|
|
|
+ useCustomSettings();
|
|
|
}
|
|
|
|
|
|
-QColor CPathItem::fillColor() const
|
|
|
+QColor CPathItem::highlightLineColor() const
|
|
|
{
|
|
|
- QBrush brush = this->brush();
|
|
|
- return brush.color();
|
|
|
+ return m_highlightLineColor;
|
|
|
+}
|
|
|
+
|
|
|
+void CPathItem::setHighlightLineColor(QColor c)
|
|
|
+{
|
|
|
+ m_highlightLineColor = c;
|
|
|
+ useCustomSettings();
|
|
|
}
|
|
|
|
|
|
-void CPathItem::setFillColor(QColor color)
|
|
|
+QColor CPathItem::normalFillColor() const
|
|
|
{
|
|
|
- setBrush(color);
|
|
|
+ return m_normalFillColor;
|
|
|
}
|
|
|
|
|
|
-void CPathItem::setHighlighted(bool highlighted)
|
|
|
+void CPathItem::setNormalFillColor(QColor c)
|
|
|
{
|
|
|
- setLineColor(highlighted ? Qt::blue : Qt::transparent);
|
|
|
- setFillColor(highlighted ? Qt::gray : Qt::white);
|
|
|
+ m_normalFillColor = c;
|
|
|
+ useCustomSettings();
|
|
|
+}
|
|
|
+
|
|
|
+QColor CPathItem::highlightFillColor() const
|
|
|
+{
|
|
|
+ return m_highlightFillColor;
|
|
|
+}
|
|
|
+
|
|
|
+void CPathItem::setHighlightFillColor(QColor c)
|
|
|
+{
|
|
|
+ m_highlightFillColor = c;
|
|
|
+ useCustomSettings();
|
|
|
+}
|
|
|
+
|
|
|
+bool CPathItem::highlighted() const
|
|
|
+{
|
|
|
+ return m_highlighted;
|
|
|
+}
|
|
|
+
|
|
|
+void CPathItem::setHighlighted(bool h)
|
|
|
+{
|
|
|
+ m_highlighted = h;
|
|
|
+ useCustomSettings();
|
|
|
+}
|
|
|
+
|
|
|
+void CPathItem::useCustomSettings()
|
|
|
+{
|
|
|
+ QPen pen = this->pen();
|
|
|
+ pen.setWidth(m_lineWidth);
|
|
|
+ pen.setColor(m_highlighted ? m_highlightLineColor : m_normalLineColor);
|
|
|
+ setPen(pen);
|
|
|
+
|
|
|
+ QBrush brush = this->brush();
|
|
|
+ brush.setColor(m_highlighted ? m_highlightFillColor : m_normalFillColor);
|
|
|
+ setBrush(brush);
|
|
|
}
|