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