fix call history list sorting #LINQT-2346
This commit is contained in:
parent
f039784b26
commit
7f1708dacb
3 changed files with 9 additions and 18 deletions
|
|
@ -70,7 +70,7 @@ void CallHistoryList::setSelf(QSharedPointer<CallHistoryList> me) {
|
||||||
for (auto it : linphoneCallLogs) {
|
for (auto it : linphoneCallLogs) {
|
||||||
auto model = createCallHistoryCore(it);
|
auto model = createCallHistoryCore(it);
|
||||||
toConnect(model.get());
|
toConnect(model.get());
|
||||||
callLogs->push_back(model);
|
callLogs->push_front(model);
|
||||||
}
|
}
|
||||||
mModelConnection->invokeToCore([this, callLogs]() {
|
mModelConnection->invokeToCore([this, callLogs]() {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,5 @@ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallHistoryProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const {
|
bool CallHistoryProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const {
|
||||||
auto l = getItemAtSource<CallHistoryList, CallHistoryCore>(sourceLeft.row());
|
return true;
|
||||||
auto r = getItemAtSource<CallHistoryList, CallHistoryCore>(sourceRight.row());
|
|
||||||
if (l && r) return l->mDate < r->mDate;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ ListView {
|
||||||
|
|
||||||
onResultsReceived: {
|
onResultsReceived: {
|
||||||
loading = false
|
loading = false
|
||||||
// contentY = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model: CallHistoryProxy {
|
model: CallHistoryProxy {
|
||||||
|
|
@ -49,13 +48,12 @@ ListView {
|
||||||
|
|
||||||
Component.onCompleted: cacheBuffer = Math.max(mainItem.height,0) //contentHeight>0 ? contentHeight : 0// cache all items
|
Component.onCompleted: cacheBuffer = Math.max(mainItem.height,0) //contentHeight>0 ? contentHeight : 0// cache all items
|
||||||
// remove binding loop
|
// remove binding loop
|
||||||
onContentHeightChanged: Qt.callLater(function () {
|
// onContentHeightChanged: Qt.callLater(function () {
|
||||||
if (mainItem)
|
// if (mainItem)
|
||||||
mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0
|
// mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0
|
||||||
})
|
// })
|
||||||
|
|
||||||
onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0)
|
onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) currentIndex = 0
|
||||||
currentIndex = 0
|
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
if (currentIndex < 0 && count > 0) {
|
if (currentIndex < 0 && count > 0) {
|
||||||
mainItem.currentIndex = 0 // Select first item after loading model
|
mainItem.currentIndex = 0 // Select first item after loading model
|
||||||
|
|
@ -86,8 +84,8 @@ ListView {
|
||||||
// Update position only if we are moving to current item and its position is changing.
|
// Update position only if we are moving to current item and its position is changing.
|
||||||
property var _currentItemY: currentItem?.y
|
property var _currentItemY: currentItem?.y
|
||||||
on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) {
|
on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) {
|
||||||
moveToCurrentItem()
|
moveToCurrentItem()
|
||||||
}
|
}
|
||||||
Behavior on contentY {
|
Behavior on contentY {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: moveAnimation
|
id: moveAnimation
|
||||||
|
|
@ -98,10 +96,6 @@ ListView {
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
onVisibleChanged: {
|
|
||||||
// if (!visible)
|
|
||||||
// currentIndex = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
anchors.horizontalCenter: mainItem.horizontalCenter
|
anchors.horizontalCenter: mainItem.horizontalCenter
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue