Commit 25fc82a8 authored by Alexandre Lision's avatar Alexandre Lision Committed by Edric Milaret

smartlist: fix scrolling

The addRowView is called automatically by the system to recycle views
when scrolling. This was conflicting with the fact that we want to scroll
up the list when a row is added/moved in the underlying model

We now connect on the rowInsterted signal from the Qt model, instead of
the AddRowView signal

Change-Id: I394dcb6b4cb204c6ee6ea728540c01246a62dbc7
Reviewed-by: default avatarEdric Milaret <edric.ladent-milaret@savoirfairelinux.com>
parent 274c22cb
......@@ -111,6 +111,15 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
}
});
QObject::connect(RecentModel::instance().peopleProxy(),
&QAbstractItemModel::rowsInserted,
[=](const QModelIndex &parent, int first, int last) {
Q_UNUSED(parent)
Q_UNUSED(first)
Q_UNUSED(last)
[smartView scrollRowToVisible:0];
});
[self.view setWantsLayer:YES];
[self.view setLayer:[CALayer layer]];
[self.view.layer setBackgroundColor:[NSColor whiteColor].CGColor];
......@@ -246,11 +255,6 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
return result;
}
- (void)outlineView:(NSOutlineView *)outlineView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row
{
[outlineView scrollRowToVisible:0];
}
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
{
return [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
......
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