From 967a83645ddf34bf46e5a213dfcfb57b09f6377f Mon Sep 17 00:00:00 2001 From: Armin Felder Date: Sun, 10 Feb 2019 20:07:35 +0100 Subject: [PATCH] fix message insert --- CustomModels/channelmodel.cpp | 2 +- container/sortedvector.cpp | 6 ++---- engine.pro | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CustomModels/channelmodel.cpp b/CustomModels/channelmodel.cpp index a8b060f..6339469 100644 --- a/CustomModels/channelmodel.cpp +++ b/CustomModels/channelmodel.cpp @@ -170,7 +170,7 @@ bool ChannelModel::addChannelsSlot(const QVectorgetRoomId() != "" && !duplicateCheck.contains( channel->getRoomId() ) ) { - // connect( channel.data(), &RocketChatChannel::messageAdded, this, &ChannelModel::onNewerMessage, Qt::UniqueConnection ); + //connect( channel.data(), &RocketChatChannel::messageAdded, this, &ChannelModel::onNewerMessage, Qt::UniqueConnection ); connect( channel.data(), &RocketChatChannel::unreadMessagesChanged, this, &ChannelModel::onUnreadMessageChanged, Qt::UniqueConnection ); connect( channel.data(), &RocketChatChannel::dataChanged, this, &ChannelModel::onDataChanged, Qt::UniqueConnection ); connect( channel.data(), &RocketChatChannel::channelDeleted, this, &ChannelModel::onDeleted, Qt::UniqueConnection ); diff --git a/container/sortedvector.cpp b/container/sortedvector.cpp index b760cee..47a641c 100644 --- a/container/sortedvector.cpp +++ b/container/sortedvector.cpp @@ -45,14 +45,12 @@ int SortedVector::insertSort( const QSharedPointer &pointer ) template int SortedVector::findInsertPosition( const QSharedPointer &pointer ) const { - int row = -1; auto elementSmallerThanNew = std::lower_bound( this->begin(), this->end(), pointer, []( const QSharedPointer &first, const QSharedPointer &second )->bool{ - return ( *first ) > ( *second ); + return ( *first ) < ( *second ); } ); - row = elementSmallerThanNew - this->begin(); + return elementSmallerThanNew - this->begin();; - return row; } template diff --git a/engine.pro b/engine.pro index 204158b..65ba0ed 100644 --- a/engine.pro +++ b/engine.pro @@ -1,6 +1,6 @@ TEMPLATE = lib QT += core network websockets sql concurrent -CONFIG += c++17 static +CONFIG += c++14 static SOURCES += api/meteorddp.cpp \ api/restapi.cpp \ -- GitLab