Skip to content
Snippets Groups Projects
Commit 8660373b authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Sébastien Blin
Browse files

contactadapter: fix SelectableProxyModel ownership

Currently the ownership of SelectableProxyModel instance
is assumed by QML engine, but we will use the following
rule to avoid that.

QML engine respects the normal QObject parent ownership
semantics of Qt C++ objects, and will never delete a
QObject instance which has a parent.

https: //doc.qt.io/qt-5/qtqml-cppintegration-data.html
Change-Id: Ifa37d14b8d74bfce050b0dee2949b42a7f784d3a
parent 1c7ef626
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
ContactAdapter::ContactAdapter(LRCInstance* instance, QObject* parent)
: QmlAdapterBase(instance, parent)
{
selectableProxyModel_.reset(new SelectableProxyModel(smartListModel_.get()));
selectableProxyModel_.reset(new SelectableProxyModel(this));
}
QVariant
......
......@@ -44,10 +44,9 @@ class SelectableProxyModel final : public QSortFilterProxyModel
public:
using FilterPredicate = std::function<bool(const QModelIndex&, const QRegExp&)>;
explicit SelectableProxyModel(QAbstractListModel* parent = nullptr)
explicit SelectableProxyModel(QObject* parent = nullptr)
: QSortFilterProxyModel(parent)
{
setSourceModel(parent);
setSortRole(ConversationList::Role::LastInteractionTimeStamp);
sort(0, Qt::DescendingOrder);
setFilterCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment