CPathItem.h 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef CPATHITEM_H
  2. #define CPATHITEM_H
  3. #include <QGraphicsPathItem>
  4. class CPathItem : public QGraphicsPathItem
  5. {
  6. public:
  7. CPathItem(QGraphicsItem *parent = nullptr);
  8. int lineWidth() const;
  9. void setLineWidth(int w);
  10. QColor normaLineColor() const;
  11. virtual void setNormalLineColor(QColor c);
  12. QColor highlightLineColor() const;
  13. void setHighlightLineColor(QColor c);
  14. QColor normalFillColor() const;
  15. void setNormalFillColor(QColor c);
  16. QColor highlightFillColor() const;
  17. void setHighlightFillColor(QColor c);
  18. bool highlighted() const;
  19. virtual void setHighlighted(bool h);
  20. virtual void updatePath() = 0;
  21. private:
  22. void applySettings();
  23. protected:
  24. int m_lineWidth = 1;
  25. QColor m_normalLineColor = Qt::gray;
  26. QColor m_highlightLineColor = QColor("#33cccccc");
  27. QColor m_normalFillColor = Qt::white;
  28. QColor m_highlightFillColor = QColor("#33cccccc");
  29. bool m_highlighted = false;
  30. };
  31. #endif // CPATHITEM_H