12 #include <QAbstractItemModel>
42 template<
typename TPredicate >
45 typedef std::vector<std::pair<QString, int> > Object_container;
48 int rowCount(QModelIndex
const&)
const
50 return objects_.size() + 1;
53 QVariant data(QModelIndex
const& index,
int role = Qt::DisplayRole)
const
57 if (index.row() <= 0) {
60 return objects_[index.row() - 1].first;
62 if (index.row() <= 0) {
63 return QVariant::fromValue<int>(-1);
65 return QVariant::fromValue(objects_[index.row() - 1].second);
67 return QVariant::Invalid;
71 void removeObject(
int object_id)
74 for (
unsigned int i = 0; i < objects_.size(); ++i) {
75 if (objects_[i].second == object_id) {
86 for (
int i = objects_.size() - 1; i >= 0; --i) {
87 if (objects_[i].second == object_id) {
88 objects_.erase(objects_.begin() + i);
96 Object_container objects;
98 if (predicate_(*o_it)) {
99 objects.push_back(std::make_pair(o_it->name(), o_it->id()));
102 std::sort(objects.begin(), objects.end());
103 if (objects != objects_) {
105 objects.swap(objects_);
111 Object_container objects_;
112 TPredicate predicate_;
bool dataType(DataType _type) const
#define DATA_POLYHEDRAL_MESH
#define DATA_TRIANGLE_MESH
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
#define DATA_HEXAHEDRAL_MESH