mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed unused types from scene items.
This commit is contained in:
parent
b2a1c10036
commit
f936e484cc
6 changed files with 9 additions and 16 deletions
|
@ -107,10 +107,8 @@ std::vector<ItemPtr> Scene::items(
|
||||||
auto copyItems = _items;
|
auto copyItems = _items;
|
||||||
|
|
||||||
ranges::sort(copyItems, [&](ItemPtr a, ItemPtr b) {
|
ranges::sort(copyItems, [&](ItemPtr a, ItemPtr b) {
|
||||||
const auto numA = qgraphicsitem_cast<NumberedItem*>(
|
const auto numA = static_cast<NumberedItem*>(a.get())->number();
|
||||||
a.get())->number();
|
const auto numB = static_cast<NumberedItem*>(b.get())->number();
|
||||||
const auto numB = qgraphicsitem_cast<NumberedItem*>(
|
|
||||||
b.get())->number();
|
|
||||||
return (order == Qt::AscendingOrder) ? (numA < numB) : (numA > numB);
|
return (order == Qt::AscendingOrder) ? (numA < numB) : (numA > numB);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ std::vector<MTPInputDocument> Scene::attachedStickers() const {
|
||||||
) | ranges::views::filter([](const ItemPtr &i) {
|
) | ranges::views::filter([](const ItemPtr &i) {
|
||||||
return i->isVisible() && (i->type() == ItemSticker::Type);
|
return i->isVisible() && (i->type() == ItemSticker::Type);
|
||||||
}) | ranges::views::transform([](const ItemPtr &i) {
|
}) | ranges::views::transform([](const ItemPtr &i) {
|
||||||
return qgraphicsitem_cast<ItemSticker*>(i.get())->sticker();
|
return static_cast<ItemSticker*>(i.get())->sticker();
|
||||||
}) | ranges::to_vector;
|
}) | ranges::to_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ auto Normalized(float64 angle) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
int NumberedItem::type() const {
|
||||||
|
return NumberedItem::Type;
|
||||||
|
}
|
||||||
|
|
||||||
int NumberedItem::number() const {
|
int NumberedItem::number() const {
|
||||||
return _number;
|
return _number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,10 @@ namespace Editor {
|
||||||
|
|
||||||
class NumberedItem : public QGraphicsItem {
|
class NumberedItem : public QGraphicsItem {
|
||||||
public:
|
public:
|
||||||
|
enum { Type = UserType + 1 };
|
||||||
using QGraphicsItem::QGraphicsItem;
|
using QGraphicsItem::QGraphicsItem;
|
||||||
|
|
||||||
|
int type() const override;
|
||||||
void setNumber(int number);
|
void setNumber(int number);
|
||||||
[[nodiscard]] int number() const;
|
[[nodiscard]] int number() const;
|
||||||
private:
|
private:
|
||||||
|
@ -33,7 +35,6 @@ private:
|
||||||
|
|
||||||
class ItemBase : public NumberedItem {
|
class ItemBase : public NumberedItem {
|
||||||
public:
|
public:
|
||||||
enum { Type = UserType + 1 };
|
|
||||||
|
|
||||||
ItemBase(
|
ItemBase(
|
||||||
rpl::producer<float64> zoomValue,
|
rpl::producer<float64> zoomValue,
|
||||||
|
@ -46,7 +47,6 @@ public:
|
||||||
QPainter *p,
|
QPainter *p,
|
||||||
const QStyleOptionGraphicsItem *option,
|
const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget) override;
|
QWidget *widget) override;
|
||||||
int type() const override;
|
|
||||||
|
|
||||||
bool flipped() const;
|
bool flipped() const;
|
||||||
void setFlip(bool value);
|
void setFlip(bool value);
|
||||||
|
|
|
@ -195,10 +195,6 @@ rpl::producer<ItemCanvas::Content> ItemCanvas::grabContentRequests() const {
|
||||||
return _grabContentRequests.events();
|
return _grabContentRequests.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ItemCanvas::type() const {
|
|
||||||
return Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ItemCanvas::collidesWithItem(
|
bool ItemCanvas::collidesWithItem(
|
||||||
const QGraphicsItem *,
|
const QGraphicsItem *,
|
||||||
Qt::ItemSelectionMode) const {
|
Qt::ItemSelectionMode) const {
|
||||||
|
|
|
@ -15,8 +15,6 @@ namespace Editor {
|
||||||
|
|
||||||
class ItemCanvas : public QGraphicsItem {
|
class ItemCanvas : public QGraphicsItem {
|
||||||
public:
|
public:
|
||||||
enum { Type = UserType + 6 };
|
|
||||||
|
|
||||||
struct Content {
|
struct Content {
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QPointF position;
|
QPointF position;
|
||||||
|
@ -33,7 +31,6 @@ public:
|
||||||
QPainter *p,
|
QPainter *p,
|
||||||
const QStyleOptionGraphicsItem *option,
|
const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget) override;
|
QWidget *widget) override;
|
||||||
int type() const override;
|
|
||||||
|
|
||||||
void handleMousePressEvent(not_null<QGraphicsSceneMouseEvent*> event);
|
void handleMousePressEvent(not_null<QGraphicsSceneMouseEvent*> event);
|
||||||
void handleMouseReleaseEvent(not_null<QGraphicsSceneMouseEvent*> event);
|
void handleMouseReleaseEvent(not_null<QGraphicsSceneMouseEvent*> event);
|
||||||
|
|
|
@ -13,8 +13,6 @@ namespace Editor {
|
||||||
|
|
||||||
class ItemLine : public NumberedItem {
|
class ItemLine : public NumberedItem {
|
||||||
public:
|
public:
|
||||||
enum { Type = UserType + 5 };
|
|
||||||
|
|
||||||
ItemLine(const QPixmap &&pixmap);
|
ItemLine(const QPixmap &&pixmap);
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
void paint(
|
void paint(
|
||||||
|
|
Loading…
Add table
Reference in a new issue