123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "CPathItem.h"
- #include <QPen>
- CPathItem::CPathItem(QGraphicsItem *parent) : QGraphicsPathItem(parent) { }
- int CPathItem::lineWidth() const
- {
- QPen pen = this->pen();
- return pen.width();
- }
- void CPathItem::setLineWidth(int width)
- {
- QPen pen = this->pen();
- pen.setWidth(width);
- setPen(pen);
- }
- QColor CPathItem::lineColor() const
- {
- QPen pen = this->pen();
- return pen.color();
- }
- void CPathItem::setLineColor(QColor color)
- {
- QPen pen = this->pen();
- pen.setColor(color);
- setPen(pen);
- }
- QColor CPathItem::fillColor() const
- {
- QBrush brush = this->brush();
- return brush.color();
- }
- void CPathItem::setFillColor(QColor color)
- {
- setBrush(color);
- }
- void CPathItem::setHighlighted(bool highlighted)
- {
- setLineColor(highlighted ? Qt::blue : Qt::transparent);
- setFillColor(highlighted ? Qt::gray : Qt::white);
- }
|