2 #include <score/model/IdentifiedObjectAbstract.hpp>
11 class Selection final :
private QList<QPointer<IdentifiedObjectAbstract>>
13 using base_type = QList<QPointer<IdentifiedObjectAbstract>>;
17 using base_type::base_type;
18 using base_type::begin;
19 using base_type::cbegin;
20 using base_type::cend;
21 using base_type::clear;
22 using base_type::constBegin;
23 using base_type::constEnd;
24 using base_type::contains;
25 using base_type::empty;
27 using base_type::erase;
28 using base_type::removeAll;
29 using base_type::size;
31 static Selection fromList(
const QList<IdentifiedObjectAbstract*>& other)
36 s.base_type::append(elt);
43 for(
const auto& ptr : *
this)
45 if(ptr.data() == &obj)
53 for(
const auto& ptr : *
this)
67 base_type::append(ptr);
70 void append(
const base_type::value_type& obj)
73 base_type::append(obj);
76 void append(base_type::value_type&& obj)
79 base_type::append(std::move(obj));
82 bool operator==(
const Selection& other)
const
84 return static_cast<const base_type&
>(*this) ==
static_cast<const base_type&
>(other);
87 bool operator!=(
const Selection& other)
const
89 return static_cast<const base_type&
>(*this) !=
static_cast<const base_type&
>(other);
92 QList<const IdentifiedObjectAbstract*> toList()
const
94 QList<const IdentifiedObjectAbstract*> l;
95 for(
const auto& elt : *
this)
100 SCORE_LIB_BASE_EXPORT
101 void removeDuplicates();
104 template <
typename T>
125 const auto ptr =
const_cast<std::remove_const_t<T>*
>(pressedModel);
127 if(pressedModel->selection.get())
157 for(
auto& elt : currentSelection)
158 newSelection.append(elt);
164 inline QDataStream& operator<<(QDataStream& i,
const Selection& sel)
168 inline QDataStream& operator>>(QDataStream& i,
Selection& sel)
Base class for IdentifiedObject.
Definition: IdentifiedObjectAbstract.hpp:16
Definition: Selection.hpp:12