File: GraphTableModel.cpp

package info (click to toggle)
tulip 3.7.0dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 39,428 kB
  • sloc: cpp: 231,403; php: 11,023; python: 1,128; sh: 671; yacc: 522; makefile: 315; xml: 63; lex: 55
file content (690 lines) | stat: -rwxr-xr-x 21,212 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
#include "GraphTableModel.h"

#include <tulip/Graph.h>
#include <tulip/TlpQtTools.h>
#include "TulipQVariantBuilder.h"


using namespace tlp;
using namespace std;


/**
  * @brief Sort elements in function of the given property values.
  **/
struct PropertyValueComparator {
public:
  PropertyValueComparator(Qt::SortOrder sortOrder,ElementType type,PropertyInterface* property):_sortOrder(sortOrder),_elementType(type),_property(property) {}
  PropertyValueComparator(const PropertyValueComparator& other):_sortOrder(other._sortOrder),_elementType(other._elementType),_property(other._property) {}
  bool operator()(unsigned int elt1,unsigned int elt2) {
    if(_elementType == NODE) {
      if(_sortOrder == Qt::AscendingOrder) {
        return _property->compare(node(elt1),node(elt2)) <= -1 ;
      }
      else {
        return _property->compare(node(elt1),node(elt2)) >= 1 ;
      }
    }
    else {
      if(_sortOrder == Qt::AscendingOrder) {
        return _property->compare(edge(elt1),edge(elt2)) <= -1 ;
      }
      else {
        return _property->compare(edge(elt1),edge(elt2)) >= 1 ;
      }
    }
  }
private:
  Qt::SortOrder _sortOrder;
  ElementType _elementType;
  PropertyInterface* _property;
};

/**
  * @brief Sort properties by name.
  **/
struct PropertyComparator {
public:
  bool operator()(PropertyInterface* p1,PropertyInterface* p2) {
    return p1->getName().compare(p2->getName())<0;
  }
};


GraphTableModelIndex::GraphTableModelIndex(unsigned int element,PropertyInterface* property):_element(element),_property(property) {

}

GraphTableModel::GraphTableModel(Graph* graph,ElementType displayType,QObject* parent ):QAbstractTableModel(parent),_graph(NULL),_elementType(displayType),_orientation(Qt::Vertical),_sortingProperty(NULL),_order(Qt::AscendingOrder) {
  setGraph(graph);
}

void GraphTableModel::setGraph(Graph* newGraph) {
  if(_graph != NULL) {
    _graph->removeObserver(this);
    _graph->removeGraphObserver(this);
  }

  _graph = newGraph;

  if(_graph != NULL) {
    _graph->addObserver(this);
    _graph->addGraphObserver(this);
  }

  updateElementsTable();
  updatePropertyTable();
  reset();
}

void GraphTableModel::setElementType(ElementType type) {
  _elementType = type;
  updateElementsTable();
  reset();
}

void GraphTableModel::setOrientation(Qt::Orientation orientation) {
  _orientation = orientation;
  reset();
}
unsigned int GraphTableModel::idForIndex(int index,const QModelIndex&) const {
  if(index > -1 && (unsigned int)index < _idTable.size()) {
    return _idTable[index];
  }
  else {
    return UINT_MAX;
  }
}

QList<int> GraphTableModel::indexesForIds(const set<unsigned int>& ids)const {
  QList<int> indexes;

  for(int i = 0 ; (unsigned int)i< _idTable.size(); ++i) {
    if(ids.find(idForIndex(i))!=ids.end()) {
      indexes.push_back(i);
    }
  }

  return indexes;
}

PropertyInterface* GraphTableModel::propertyForIndex(int index,const QModelIndex&) const {
  if(index > -1 && (unsigned int)index < _propertiesTable.size()) {
    //If the property is going to be deleted.
    if(_propertiesToDelete.find(_propertiesTable[index]) == _propertiesToDelete.end()) {
      return _propertiesTable[index];
    }
    else {
      return NULL;
    }
  }
  else {
    return NULL;
  }
}

QList<int> GraphTableModel::indexesForProperties(const std::set<tlp::PropertyInterface*>& properties)const {
  QList<int> indexes;

  for(int i = 0 ; (unsigned int)i< _propertiesTable.size(); ++i) {
    if(properties.find(propertyForIndex(i))!=properties.end()) {
      indexes.push_back(i);
    }
  }

  return indexes;
}

pair<QModelIndex,QModelIndex> GraphTableModel::computeElementsArea(const set<unsigned int>& elementsIds)const {
  pair<unsigned int,unsigned int> fromTo = computeArea<unsigned int>(elementsIds,_idTable,_idToIndex);

  if(_orientation == Qt::Vertical) {
    return make_pair(index(0,fromTo.first),index(columnCount()-1,fromTo.second));
  }
  else {
    return make_pair(index(fromTo.first,0),index(rowCount()-1,fromTo.second));
  }
}


pair<QModelIndex,QModelIndex> GraphTableModel::computePropertiesArea(const set<tlp::PropertyInterface*>& properties)const {
  pair<unsigned int,unsigned int> fromTo = computeArea<PropertyInterface*>(properties,_propertiesTable,_propertyToIndex);

  if(_orientation == Qt::Vertical) {
    return make_pair(index(fromTo.first,0),index(rowCount()-1,fromTo.second));
  }
  else {
    return make_pair(index(0,fromTo.first),index(columnCount()-1,fromTo.second));
  }
}

void GraphTableModel::updateElementsTable() {
  _idTable.clear();

  if(_graph != NULL) {
    if(_elementType == NODE) {
      node n;
      forEach(n,_graph->getNodes()) {
        _idTable.push_back(n.id);
      }
    }
    else {
      edge e;
      forEach(e,_graph->getEdges()) {
        _idTable.push_back(e.id);
      }
    }
  }

  updateIndexMap<unsigned int>(_idTable,_idToIndex);
}

void GraphTableModel::updatePropertyTable() {
  _propertiesTable.clear();

  if(_graph != NULL) {
    PropertyInterface* property;
    forEach(property,_graph->getObjectProperties()) {
      if(useProperty(property)) {
        property->removePropertyObserver(this);
        property->removeObserver(this);
        _propertiesTable.push_back(property);
        property->addPropertyObserver(this);
        property->addObserver(this);
      }
    }
    PropertyComparator comparator;
    std::stable_sort(_propertiesTable.begin(),_propertiesTable.end(),comparator);
  }

  updateIndexMap<PropertyInterface*>(_propertiesTable,_propertyToIndex);
}

bool GraphTableModel::useProperty(PropertyInterface* property) const {
  TulipQVariantBuilder qvariantBuilder;

  switch(qvariantBuilder.getPropertyType(_elementType,property)) {
  case INVALID_PROPERTY_RTTI:
    return false;
    break;

  default:
    return true;
  }
}

int GraphTableModel::columnCount(const QModelIndex& ) const {
  return _orientation == Qt::Vertical?_propertiesTable.size():_idTable.size();
}
int GraphTableModel::rowCount(const QModelIndex& ) const {
  return _orientation == Qt::Vertical?_idTable.size():_propertiesTable.size();
}

QVariant GraphTableModel::data(const QModelIndex& index, int role ) const {
  switch(role) {
  default:
    GraphTableModelIndex tableIndex = element(index);

    //Check if the cell is valid : the node and and the property must be defined
    //If the property is going to be deleted don't display data
    if(tableIndex.isValid() && _propertiesToDelete.find(tableIndex.property())==_propertiesToDelete.end()) {
      TulipQVariantBuilder helper;
      return helper.data(_graph,role,_elementType,tableIndex.element(),tableIndex.property());
    }
  }

  return QVariant();
}

bool GraphTableModel::setAllElementsData(unsigned int propertyIndex,const QVariant & value, int role) {
  switch(role) {
  case Qt::EditRole:
    TulipQVariantBuilder helper;
    PropertyInterface* property = propertyForIndex(propertyIndex);
    return helper.setAllElementData(value,_elementType,property);
    break;
  }

  return false;
}

bool GraphTableModel::setData( const QModelIndex & index, const QVariant & value, int role ) {
  switch(role) {
  case Qt::EditRole:
    GraphTableModelIndex tableIndex = element(index);

    if(tableIndex.isValid()) {
      TulipQVariantBuilder helper;
      return helper.setData(value,_elementType,tableIndex.element(),tableIndex.property());
    }

    break;
  }

  return false;
}

QVariant GraphTableModel::headerData(int section, Qt::Orientation orientation, int role ) const {
  switch(role) {
  case Qt::DisplayRole:

    if(orientation == Qt::Vertical) {
      return QVariant(QString::number(_idTable[section]));
    }
    else {
      PropertyInterface* property = _propertiesTable[section];

      if(_propertiesToDelete.find(property)==_propertiesToDelete.end()) {
        QString name = QString::fromStdString(property->getName());
        name.append("\n");
        name.append("( ");
        name.append(propertyInterfaceToPropertyTypeLabel(_propertiesTable[section]));
        name.append(" )");
        return QVariant(name);
      }
    }

    break;

  case Qt::ToolTipRole:

    if(orientation == Qt::Horizontal) {
      PropertyInterface* property = _propertiesTable[section];

      if(_propertiesToDelete.find(property)==_propertiesToDelete.end()) {
        QString toolTip;
        toolTip.append("Property : ");
        toolTip.append(tlpStringToQString(property->getName()));
        toolTip.append("\n");
        toolTip.append("Type : ");
        toolTip.append(propertyInterfaceToPropertyTypeLabel(property));
        toolTip.append("\n");
        Graph* propertyGraph = property->getGraph();

        if(propertyGraph != _graph) {
          string name;
          propertyGraph->getAttribute<string>("name", name);
          toolTip.append("Inherited property from graph : ");
          toolTip.append(tlpStringToQString(name));
          toolTip.append(" ( ");
          toolTip.append(QString::number(propertyGraph->getId()));
          toolTip.append(" )");
        }
        else {
          toolTip.append("Local property");
        }

        return QVariant(toolTip);
      }
    }

    break;

  case Qt::DecorationRole: {
    if(orientation == Qt::Horizontal) {
      PropertyInterface* property = _propertiesTable[section];

      if(_propertiesToDelete.find(property)==_propertiesToDelete.end()) {
        return property->getGraph() != _graph?QVariant(QIcon(":/spreadsheet/inherited_properties.png")):QVariant();
      }
    }
  }
  break;
  }

  return QVariant();
}

Qt::ItemFlags GraphTableModel::flags( const QModelIndex & index ) const {
  GraphTableModelIndex tableIndex = element(index);
  Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index);

  if(tableIndex.isValid() && _propertiesToDelete.find(tableIndex.property())==_propertiesToDelete.end()) {
    TulipQVariantBuilder helper;
    return helper.flags(defaultFlags,_elementType,tableIndex.element(),tableIndex.property());
  }
  else {
    return defaultFlags;
  }

}
void GraphTableModel::sort( int column, Qt::SortOrder order ) {
  if(_orientation == Qt::Vertical) {
    if(column >-1 && column < columnCount()) {
      sortElements(_propertiesTable[column],order);
    }
  }
}

void GraphTableModel::sortElements(tlp::PropertyInterface* property, Qt::SortOrder order) {
  assert(property!=NULL);
  _order = order;
  _sortingProperty = property;
  PropertyValueComparator comparator(order,_elementType,_sortingProperty);
  std::stable_sort(_idTable.begin(),_idTable.end(),comparator);
  updateIndexMap<unsigned int>(_idTable,_idToIndex);
  emit dataChanged(index(0,0),index(rowCount()-1,columnCount()-1));

  if(_orientation == Qt::Vertical) {
    emit headerDataChanged ( Qt::Vertical, 0, rowCount()-1 );
  }
  else {
    emit headerDataChanged ( Qt::Horizontal, 0, columnCount()-1 );
  }
}

bool GraphTableModel::removeColumns( int column, int count, const QModelIndex & parent ) {
  if(column > -1 && column+count <columnCount(parent)) {
    if(_orientation == Qt::Vertical) {
      return removeProperties(column,column+count-1,parent);
    }
    else {
      return removeElements(column,column+count-1,parent);
    }
  }
  else {
    return false;
  }
}

bool GraphTableModel::removeRows(int row, int count, const QModelIndex &parent) {
  if(row > -1 && row+count <rowCount(parent)) {
    if(_orientation == Qt::Vertical) {
      return removeElements(row,row+count-1,parent);
    }
    else {
      return removeProperties(row,row+count-1,parent);
    }
  }
  else {
    return false;
  }
}

bool GraphTableModel::removeElements(int first,int last,const QModelIndex& parent) {
  if(_graph != NULL) {
    for(int i = first ; i <= last ; ++i) {
      if(_elementType == NODE) {
        _graph->delNode(node(idForIndex(i,parent)));
      }
      else {
        _graph->delEdge(edge(idForIndex(i,parent)));
      }
    }

    return true;
  }
  else {
    return false;
  }
}

bool GraphTableModel::removeProperties(int first,int last,const QModelIndex& parent) {
  if(_graph != NULL) {
    for(int i = first ; i <= last ; ++i) {
      PropertyInterface* propertyInterface = propertyForIndex(i,parent);
      string name = propertyInterface->getName();
      propertyInterface->getGraph()->delLocalProperty(name);
    }

    return true;
  }
  else {
    return false;
  }
}

bool GraphTableModel::removeColumns( const QModelIndexList& toRemove) {
  set<int> columns;

  for(QModelIndexList::const_iterator it = toRemove.begin() ; it != toRemove.end() ; ++it) {
    int column = (*it).column();

    if(columns.find(column) == columns.end()) {
      columns.insert(column);
    }
  }

  for(set<int>::reverse_iterator it = columns.rbegin(); it != columns.rend(); ++it) {
    if(!removeColumns((*it),1)) {
      return false;
    }
  }

  return true;
}

bool GraphTableModel::removeRows( const QModelIndexList& toRemove) {
  set<int> rows;

  for(QModelIndexList::const_iterator it = toRemove.begin() ; it != toRemove.end() ; ++it) {
    int row = (*it).row();

    if(rows.find(row) == rows.end()) {
      rows.insert(row);
    }
  }

  for(set<int>::reverse_iterator it = rows.rbegin(); it != rows.rend(); ++it) {
    if(!removeRows((*it),1)) {
      return false;
    }
  }

  return true;
}


void GraphTableModel::addNode(Graph *, const node n) {
  if(_elementType == NODE) {
    _idsToAdd.insert(n.id);
  }
}

void GraphTableModel::addEdge(Graph *, const edge e) {
  if(_elementType == EDGE) {
    _idsToAdd.insert(e.id);
  }
}

void GraphTableModel::delNode(Graph *,const node n) {
  if(_elementType == NODE) {
    _idsToDelete.insert(n.id);
  }
}

void GraphTableModel::delEdge(Graph *,const edge e) {
  if(_elementType == EDGE) {
    _idsToDelete.insert(e.id);
  }
}
void GraphTableModel::addLocalProperty(Graph* g, const string& propertyName) {
  PropertyInterface* property = g->getProperty(propertyName);

  //Check if we need to add the property
  if(useProperty(property)) {
    //If there is an existing inherited property with the same name hide the inherited property.
    for(unsigned int i = 0; i < _propertiesTable.size(); ++i) {
      //Find an existing property override them
      //Check if the property is marked for deletion.
      if( _propertiesToDelete.find(_propertiesTable[i])== _propertiesToDelete.end() && _propertiesTable[i]->getName().compare(propertyName)==0) {
        _propertiesToDelete.insert(_propertiesTable[i]);
        break;
      }
    }

    _propertiesToAdd.insert(property);
  }
}

void GraphTableModel::beforeDelLocalProperty(tlp::Graph *graph, const std::string & name) {
  PropertyInterface* property = graph->getProperty(name);

  //If the property was added then deleted before an update of the table
  if(_propertiesToAdd.find(property) != _propertiesToAdd.end()) {
    _propertiesToAdd.erase(property);
  }
  else {
    _propertiesToDelete.insert(property);
    removeFromVector<PropertyInterface*>(_propertiesToDelete,_propertiesTable,_propertyToIndex,_orientation==Qt::Horizontal);
    _propertiesToDelete.clear();
    property->removePropertyObserver(this);
    property->removeObserver(this);
  }
}

void GraphTableModel::addInheritedProperty(Graph* g, const string& propertyName) {
  _propertiesToAdd.insert(g->getProperty(propertyName));
}

void GraphTableModel::beforeDelInheritedProperty(Graph *graph, const std::string &name) {
  PropertyInterface* property = graph->getProperty(name);

  //If the property was added then deleted before an update of the table
  if(_propertiesToAdd.find(property) != _propertiesToAdd.end()) {
    _propertiesToAdd.erase(property);
  }
  else {
    _propertiesToDelete.insert(property);
    removeFromVector<PropertyInterface*>(_propertiesToDelete,_propertiesTable,_propertyToIndex,_orientation==Qt::Horizontal);
    _propertiesToDelete.clear();
    property->removePropertyObserver(this);
    property->removeObserver(this);

  }

}

void GraphTableModel::afterSetNodeValue(PropertyInterface* property, const node n) {
  if(_elementType == NODE) {
    //If the element was not marked for deletion
    if(_idsToDelete.find(n.id) == _idsToDelete.end()) {
      _dataUpdated.push_back(GraphTableModelIndex(n.id,property));
    }
  }
}

void GraphTableModel::afterSetEdgeValue(PropertyInterface* property, const edge e) {
  if(_elementType == EDGE) {
    //If the element was not marked for deletion
    if(_idsToDelete.find(e.id) == _idsToDelete.end()) {
      _dataUpdated.push_back(GraphTableModelIndex(e.id,property));
    }
  }
}

void GraphTableModel::afterSetAllNodeValue(PropertyInterface* property) {
  if(_elementType == NODE) {
    _propertiesUpdated.insert(property);
  }
}

void GraphTableModel::afterSetAllEdgeValue(PropertyInterface* property) {
  if(_elementType == EDGE) {
    _propertiesUpdated.insert(property);
  }
}

void GraphTableModel::update() {
  //Remove deleted properties and elements from vector.
  if(!_idsToDelete.empty()) {
    removeFromVector<unsigned int>(_idsToDelete,_idTable,_idToIndex,_orientation==Qt::Vertical);
    _idsToDelete.clear();
  }

  if(!_propertiesToDelete.empty()) {
    removeFromVector<PropertyInterface*>(_propertiesToDelete,_propertiesTable,_propertyToIndex,_orientation==Qt::Horizontal);

    //Check if the sorting property is deleted
    if(_propertiesToDelete.find(_sortingProperty)!= _propertiesToDelete.end()) {
      //No sort property
      _sortingProperty = NULL;
    }

    _propertiesToDelete.clear();
  }

  if(!_idsToAdd.empty()) {
    PropertyValueComparator *comparator = _sortingProperty != NULL?(new PropertyValueComparator(_order,_elementType,_sortingProperty)):(NULL);
    addToVector<unsigned int,PropertyValueComparator>(_idsToAdd,_idTable,_idToIndex,_orientation==Qt::Vertical,comparator);
    delete comparator;
    _idsToAdd.clear();
  }

  if(!_propertiesToAdd.empty()) {
    PropertyComparator comparator;
    addToVector<PropertyInterface*,PropertyComparator>(_propertiesToAdd,_propertiesTable,_propertyToIndex,_orientation==Qt::Horizontal,&comparator);

    for(set<PropertyInterface*>::iterator it = _propertiesToAdd.begin() ; it != _propertiesToAdd.end(); ++it) {
      (*it)->addPropertyObserver(this);
      (*it)->addObserver(this);
    }

    _propertiesToAdd.clear();
  }

  //Send modification events.
  if(!_propertiesUpdated.empty() || !_dataUpdated.empty()) {
    bool needToSort = false;

    if(_sortingProperty != NULL) {
      //If the sorting property is updated we need to sort elements again.
      //Check if we have a value updated in the sorting property

      if(_orientation == Qt::Vertical) {
        //Check if a set all node/edge value occur on the sorting property
        if(_propertiesUpdated.find(_sortingProperty) != _propertiesUpdated.end()) {
          needToSort = true;
        }

        //Check if a node/edge value modification occur on the sorting property
        if(!needToSort) {
          for(vector<GraphTableModelIndex>::iterator it = _dataUpdated.begin(); it != _dataUpdated.end(); ++it) {
            if((*it).property()==_sortingProperty) {
              needToSort = true;
              break;
            }
          }
        }
      }
    }

    if(needToSort) {
      //Sort elements update all the data
      sortElements(_sortingProperty,_order);
    }
    else {
      //Compute the area to update.
      int first = 0;
      int left = 0;
      int last = rowCount()-1;
      int right = columnCount()-1;
      //If properties where updated we need to update all the elements so there os no need to compute the area for updated elements.
      set<PropertyInterface*> properties = _propertiesUpdated;
      set<unsigned int> elements;
      //If a set all node/edge value was called need to update all properties
      bool updateAllElements  = !_propertiesUpdated.empty();

      for( vector<GraphTableModelIndex>::iterator it = _dataUpdated.begin(); it != _dataUpdated.end() ; ++it) {
        properties.insert((*it).property());
        elements.insert((*it).element());
      }

      pair<unsigned int,unsigned int> propertiesArea = computeArea<PropertyInterface*>(properties,_propertiesTable,_propertyToIndex);
      left = propertiesArea.first;
      right = propertiesArea.second;

      if(!updateAllElements) {
        pair<unsigned int,unsigned int> elementsArea = computeArea<unsigned int>(elements,_idTable,_idToIndex);
        first = elementsArea.first;
        last = elementsArea.second;
      }

      emit dataChanged(index(first,left),index(last,right));
    }

    _propertiesUpdated.clear();
    _dataUpdated.clear();
  }
}