44 #include "ObjectListItemModel.hh" 49 ObjectListItemModel::ObjectListItemModel() {
52 ObjectListItemModel::~ObjectListItemModel() {
55 int ObjectListItemModel::rowCount(
const QModelIndex & parent)
const {
56 return objects_.size() + 1;
59 QVariant ObjectListItemModel::data(
const QModelIndex & index,
int role)
const {
62 if (index.row() <= 0)
return tr(
"<none>");
63 return objects_[index.row() - 1].getName();
65 if (index.row() <= 0)
return QVariant::fromValue<int>(-1);
66 return QVariant::fromValue(objects_[index.row() - 1].getId());
68 return QVariant::Invalid;
72 void ObjectListItemModel::removeObject(
int _id)
75 for (
int i = (
int)objects_.size()-1; i>=0; i--)
77 if (objects_[i].getId() == _id)
78 objects_.erase(objects_.begin()+i);
83 void ObjectListItemModel::refresh(
const DataType &datatype) {
84 std::vector<ObjectInfo>
objects;
85 objects.push_back(ObjectInfo(
"ALL_OBJECTS", -13));
86 objects.push_back(ObjectInfo(
"TARGET_OBJECTS", -14));
87 objects.push_back(ObjectInfo(
"SOURCE_OBJECTS", -15));
91 objects.push_back(ObjectInfo(o_it->name(), o_it->id()));
94 std::sort(objects.begin(), objects.end());
96 if (objects != objects_) {
98 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.