Skip to content
Snippets Groups Projects
Commit db880264 authored by Emmanuel Lepage Vallée's avatar Emmanuel Lepage Vallée Committed by Stepan Salenikovich
Browse files

useractionmodel: Make execute invokable.


Also change a proxy model property to a model interface. The
bindings have trouble exporting the proxies. This is probably a
Qt bug. This has no side effect I am aware of. They both share
the same interface.

Also remove commented out code which inits the role names.

[SS: add change missing from commit msg]

Change-Id: Ib3d2e3ed3b96d9d83a711a9005235d886840dfe5
Signed-off-by: default avatarStepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Reviewed-by: default avatarStepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
parent 62855cbe
Branches
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment