diff --git a/src/useractionmodel.cpp b/src/useractionmodel.cpp index 54ebec8978ac4669f38d1c0b79d06066b354362b..73a23354b86a2d8df2f4152a3852f0e5b70a4124 100644 --- a/src/useractionmodel.cpp +++ b/src/useractionmodel.cpp @@ -612,11 +612,11 @@ UserActionModel::~UserActionModel() QHash<int,QByteArray> UserActionModel::roleNames() const { static QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); - /*static bool initRoles = false; + static bool initRoles = false; if (!initRoles) { initRoles = true; - - }*/ + roles[(int)Role::ACTION] = "action"; + } return roles; } @@ -1177,7 +1177,7 @@ bool UserActionModel::execute(const QModelIndex& idx) const } ///Get a model filter with only the available actions -QSortFilterProxyModel* UserActionModel::activeActionModel() const +QAbstractItemModel* UserActionModel::activeActionModel() const { if (!d_ptr->m_pActiveModel) d_ptr->m_pActiveModel = new ActiveUserActionModel(const_cast<UserActionModel*>(this)); diff --git a/src/useractionmodel.h b/src/useractionmodel.h index 12014e259a7cae00fdab3e90700f4169cef3ff08..df57b2c8832b668255f13c8594d490f799fcc2db 100644 --- a/src/useractionmodel.h +++ b/src/useractionmodel.h @@ -127,7 +127,7 @@ public: }; Q_FLAGS(Context) - Q_PROPERTY(QSortFilterProxyModel* activeActionModel READ activeActionModel) + Q_PROPERTY(QAbstractItemModel* activeActionModel READ activeActionModel CONSTANT) //Constructor explicit UserActionModel(Call* parent , const FlagPack<Context> c = FlagPack<Context>(Context::MINIMAL)| Context::RECOMMENDED); @@ -144,13 +144,13 @@ public: //Getters Q_INVOKABLE bool isActionEnabled ( UserActionModel::Action action ) const; Q_INVOKABLE uint relativeIndex ( UserActionModel::Action action ) const; - QSortFilterProxyModel* activeActionModel() const; + QAbstractItemModel* activeActionModel() const; //Setters void setSelectionModel(QItemSelectionModel* sm); //Mutators - bool execute( const Action action ) const; + Q_INVOKABLE bool execute( const Action action ) const; bool execute( const QModelIndex& idx ) const; //Operators