Loading...
Searching...
No Matches
GraphicsItem.hpp
1#pragma once
2#include <QList>
3#include <QPainterPath>
4#include <QUrl>
5
6#include <score_lib_base_export.h>
7
8#include <memory>
9#include <optional>
10#include <verdigris>
11class QGraphicsObject;
12class QGraphicsItem;
13class QGraphicsView;
14
15namespace score
16{
17struct DocumentContext;
18}
26SCORE_LIB_BASE_EXPORT void deleteGraphicsObject(QGraphicsObject* item);
27SCORE_LIB_BASE_EXPORT void deleteGraphicsItem(QGraphicsItem* item);
28
29SCORE_LIB_BASE_EXPORT
30QGraphicsView* getView(const QGraphicsItem& self);
31SCORE_LIB_BASE_EXPORT
32QGraphicsView* getView(const QPainter& painter);
33
34SCORE_LIB_BASE_EXPORT
35QImage newImage(double logical_w, double logical_h);
36
37SCORE_LIB_BASE_EXPORT
38std::optional<QPointF> mapPointToItem(QPoint global, QGraphicsItem& item);
39
40SCORE_LIB_BASE_EXPORT
41void registerItemHelp(int itemType, QString tooltip, QUrl url) noexcept;
42SCORE_LIB_BASE_EXPORT
43QUrl getItemHelpUrl(int itemType) noexcept;
44
45template <typename T>
47{
48 T* impl{};
49 graphics_item_ptr() = default;
50 graphics_item_ptr(const graphics_item_ptr&) = default;
51 graphics_item_ptr(graphics_item_ptr&&) noexcept = default;
52 graphics_item_ptr& operator=(const graphics_item_ptr&) = default;
53 graphics_item_ptr& operator=(graphics_item_ptr&&) noexcept = default;
54
56 : impl{p}
57 {
58 }
59
60 ~graphics_item_ptr() { deleteGraphicsItem(impl); }
61
62 auto operator=(T* other) { impl = other; }
63
64 operator bool() const { return impl; }
65
66 operator T*() const { return impl; }
67
68 T& operator*() const { return *impl; }
69
70 T* operator->() const { return impl; }
71};
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition GraphicsItem.hpp:47