Commit 290ee95d authored by David Edmundson's avatar David Edmundson
Browse files

Add convenience method to get a persistent model index from TasksModel

Summary: Used in the minimizeAll plasmoid (see D10019)

Test Plan: Used in applet

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11059
parent 70f8f197
......@@ -1712,6 +1712,11 @@ QModelIndex TasksModel::makeModelIndex(int row, int childRow) const
return QModelIndex();
}
QPersistentModelIndex TasksModel::makePersistentModelIndex(int row, int childCount) const
{
return QPersistentModelIndex(makeModelIndex(row, childCount));
}
void TasksModel::classBegin()
{
d->usedByQml = true;
......
......@@ -811,6 +811,17 @@ public:
*/
Q_INVOKABLE QModelIndex makeModelIndex(int row, int childRow = -1) const;
/**
* Given a row in the model, returns a QPersistentModelIndex for it. To get an index
* for a child in a task group, an optional child row may be passed as well.
*
* @param row A row index in the model.
* @param childRow A row index for a child of the task group at the given row.
* @returns a model index for the task at the given row, or for one of its
* child tasks.
*/
Q_INVOKABLE QPersistentModelIndex makePersistentModelIndex(int row, int childRow = -1) const;
void classBegin() override;
void componentComplete() override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment