50 #include "ObjectListItemModel.hh"
54 ObjectListItemModel::ObjectListItemModel() {
57 ObjectListItemModel::~ObjectListItemModel() {
60 int ObjectListItemModel::rowCount(
const QModelIndex & parent)
const {
61 return objects_.size() + 1;
64 QVariant ObjectListItemModel::data(
const QModelIndex & index,
int role)
const {
67 if (index.row() <= 0)
return tr(
"<none>");
68 return objects_[index.row() - 1].getName();
70 if (index.row() <= 0)
return QVariant::fromValue<int>(-1);
71 return QVariant::fromValue(objects_[index.row() - 1].getId());
73 return QVariant::Invalid;
77 void ObjectListItemModel::removeObject(
int _id)
80 for (
int i = (
int)objects_.size()-1; i>=0; i--)
82 if (objects_[i].getId() == _id)
83 objects_.erase(objects_.begin()+i);
88 void ObjectListItemModel::refresh(
const DataType &datatype) {
89 std::vector<ObjectInfo>
objects;
90 objects.push_back(ObjectInfo(
"ALL_OBJECTS", -13));
91 objects.push_back(ObjectInfo(
"TARGET_OBJECTS", -14));
92 objects.push_back(ObjectInfo(
"SOURCE_OBJECTS", -15));
96 objects.push_back(ObjectInfo(o_it->name(), o_it->id()));
99 std::sort(objects.begin(), objects.end());
101 if (objects != objects_) {
103 objects.swap(objects_);
const QStringList ALL_OBJECTS
Iterable object range.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.