scene_item_line.h 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "editor/scene/scene_item_base.h"
  9. namespace Editor {
  10. class ItemLine : public NumberedItem {
  11. public:
  12. ItemLine(const QPixmap &&pixmap);
  13. QRectF boundingRect() const override;
  14. void paint(
  15. QPainter *p,
  16. const QStyleOptionGraphicsItem *option,
  17. QWidget *widget) override;
  18. bool hasState(SaveState state) const override;
  19. void save(SaveState state) override;
  20. void restore(SaveState state) override;
  21. protected:
  22. bool collidesWithItem(
  23. const QGraphicsItem *,
  24. Qt::ItemSelectionMode) const override;
  25. bool collidesWithPath(
  26. const QPainterPath &,
  27. Qt::ItemSelectionMode) const override;
  28. private:
  29. const QPixmap _pixmap;
  30. const QRectF _rect;
  31. struct {
  32. bool saved = false;
  33. NumberedItem::Status status;
  34. } _saved, _keeped;
  35. };
  36. } // namespace Editor