/ proxyroles / proxyrole.cpp
proxyrole.cpp
 1  #include "proxyrole.h"
 2  #include "qqmlsortfilterproxymodel.h"
 3  
 4  namespace qqsfpm {
 5  
 6  /*!
 7      \qmltype ProxyRole
 8      \inqmlmodule SortFilterProxyModel
 9      \ingroup ProxyRoles
10      \brief Base type for the \l SortFilterProxyModel proxy roles.
11  
12      The ProxyRole type cannot be used directly in a QML file.
13      It exists to provide a set of common properties and methods,
14      available across all the other proxy role types that inherit from it.
15      Attempting to use the ProxyRole type directly will result in an error.
16  */
17  
18  QVariant ProxyRole::roleData(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString &name)
19  {
20      if (m_mutex.tryLock()) {
21          QVariant result = data(sourceIndex, proxyModel, name);
22          m_mutex.unlock();
23          return result;
24      }
25      return {};
26  }
27  
28  void ProxyRole::proxyModelCompleted(const QQmlSortFilterProxyModel &proxyModel)
29  {
30      Q_UNUSED(proxyModel)
31  }
32  
33  void ProxyRole::invalidate()
34  {
35      Q_EMIT invalidated();
36  }
37  
38  }