1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #include "CPathItem.h"
- #include <QPen>
- 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);
- QBrush brush = this->brush();
- brush.setColor(m_highlighted ? m_highlightFillColor : m_normalFillColor);
- setBrush(brush);
- }
|