Commit ee098463 authored by Alexandre Lision's avatar Alexandre Lision

smartlist: fix selection

RecentModel emits a dataChanged every second for updating call timers.
This was causing scrolling issues in the list. We don't connect to dataChanged
from our NSTreeController but from the View directly. The reason is that there
is no way to update a row in a NSTreeController, only insert/remove/move and
this is causing selection updates.

Tuleap: #50
Change-Id: Ib347ff5a69f901da2bdf1d0b3a3d368fdfd23c1c
parent d14bda3b
......@@ -203,20 +203,12 @@
[self rearrangeObjects];
});
/* No way to 'update' a row, only insert/remove/move
QObject::connect(self->privateQModel,
&QAbstractItemModel::dataChanged,
[self](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
for(int row = topLeft.row() ; row <= bottomRight.row() ; ++row)
{
QModelIndex tmpIdx = self->privateQModel->index(row, 0);
if(tmpIdx.row() >= [self.arrangedObjects count]) {
Node* n = [[Node alloc] init];
if(tmpIdx.isValid())
[self insertObject:n atArrangedObjectIndexPath:[[NSIndexPath alloc] initWithIndex:row]];
}
}
[self rearrangeObjects];
});
*/
}
@end
......@@ -78,6 +78,16 @@ NSInteger const TXT_BUTTON_TAG = 500;
[smartView setTarget:self];
[smartView setDoubleAction:@selector(placeCall:)];
QObject::connect(RecentModel::instance()->peopleProxy(),
&QAbstractItemModel::dataChanged,
[self](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
for(int row = topLeft.row() ; row <= bottomRight.row() ; ++row)
{
[smartView reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:row]
columnIndexes:[NSIndexSet indexSetWithIndex:0]];
}
});
[self.view setWantsLayer:YES];
[self.view setLayer:[CALayer layer]];
[self.view.layer setBackgroundColor:[NSColor whiteColor].CGColor];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment