12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include "CPathItem.h"
- #include <QPen>
- #include <QPainter>
- CPathItem::CPathItem(QGraphicsItem *parent) : QGraphicsPathItem(parent)
- {
- applySettings();
- }
- int CPathItem::lineWidth() const
- {
- return m_lineWidth;
- }
- void CPathItem::setLineWidth(int w)
- {
- m_lineWidth = w;
- applySettings();
- }
- QColor CPathItem::normaLineColor() const
- {
- return m_normalLineColor;
- }
- void CPathItem::setNormalLineColor(QColor c)
- {
- m_normalLineColor = c;
- applySettings();
- }
- QColor CPathItem::highlightLineColor() const
- {
- return m_highlightLineColor;
- }
- void CPathItem::setHighlightLineColor(QColor c)
- {
- m_highlightLineColor = c;
- applySettings();
- }
- QColor CPathItem::normalFillColor() const
- {
- return m_normalFillColor;
- }
- void CPathItem::setNormalFillColor(QColor c)
- {
- m_normalFillColor = c;
- applySettings();
- }
- QColor CPathItem::highlightFillColor() const
- {
- return m_highlightFillColor;
- }
- void CPathItem::setHighlightFillColor(QColor c)
- {
- m_highlightFillColor = c;
- applySettings();
- }
- bool CPathItem::highlighted() const
- {
- return m_highlighted;
- }
- void CPathItem::setHighlighted(bool h)
- {
- m_highlighted = h;
- applySettings();
- }
- void CPathItem::applySettings()
- {
- QPen pen = this->pen();
- pen.setWidth(m_lineWidth);
- pen.setColor(m_highlighted ? m_highlightLineColor : m_normalLineColor);
- setPen(pen);
- setBrush(m_highlighted ? m_highlightFillColor : m_normalFillColor);
- }
|