TaskColumnModel.h header

#include <ew/app/TaskColumnModel.h>

Namespace ew::app

TaskColumnModel class

class ew::app::TaskColumnModel

A list model over the tasks in one kanban column (a single status), ordered as on the board. Cards can be dragged to reorder within the column or dropped onto another column's model. The model is read-only over the project; a drop emits moveRequested() (and reports itself unhandled so the view does not also remove the row) for the board to apply undoably.

Members

int ew::app::TaskColumnModel::DueDateRole = Qt::UserRole + 1

A data role beyond Qt::DisplayRole (the task's title): the task's due date as a QDate (invalid when unset), so a board card delegate can render a due chip.

int ew::app::TaskColumnModel::DescriptionRole = Qt::UserRole + 2

The task's free-text description (details) as a QString, so a board card delegate can show the same title+details a research-canvas card shows.

int ew::app::TaskColumnModel::IdRole = Qt::UserRole + 3

The task's id as a QString, so a stateful card delegate can key per-card UI state (such as whether the card is expanded) stably across model resets.

ew::app::TaskColumnModel::TaskColumnModel(QObject *parent=nullptr)

Constructs an empty column model with parent parent; call setSource to bind it.

void ew::app::TaskColumnModel::setSource(Workspace *workspace, QString board, QString status)

Points the model at workspace's tasks on board with status status (not owned) and resets it.

void ew::app::TaskColumnModel::refresh()

Re-reads the column's tasks and resets the model.

const QString & ew::app::TaskColumnModel::status() const

The status (column) this model shows.

ew::core::ContentId ew::app::TaskColumnModel::taskIdAt(const QModelIndex &index) const

The id of the task at index, or a null id if the index is invalid.

int ew::app::TaskColumnModel::rowCount(const QModelIndex &parent=QModelIndex()) const override

Returns the number of task cards in the column (QAbstractListModel).

QVariant ew::app::TaskColumnModel::data(const QModelIndex &index, int role=Qt::DisplayRole) const override

Returns the task card's data for index and role – the title plus the DueDate, Description, and Id user roles (QAbstractListModel).

Qt::ItemFlags ew::app::TaskColumnModel::flags(const QModelIndex &index) const override

Returns the item flags for index; cards are draggable and the column is a drop target (QAbstractListModel).

Qt::DropActions ew::app::TaskColumnModel::supportedDropActions() const override

Returns the drop actions the column accepts – a card move (QAbstractListModel).

QStringList ew::app::TaskColumnModel::mimeTypes() const override

Returns the MIME types used to carry a dragged task card (QAbstractListModel).

QMimeData * ew::app::TaskColumnModel::mimeData(const QModelIndexList &indexes) const override

Encodes the dragged task card(s) at indexes for a drop (QAbstractListModel).

bool ew::app::TaskColumnModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override

Handles a card dropped on the column: emits moveRequested() and reports itself unhandled so the view does not also remove the source row (QAbstractListModel).

void ew::app::TaskColumnModel::moveRequested(ew::core::ContentId taskId, QString toStatus, int row)

Emitted when a drag-and-drop asks to move taskId into this column (toStatus) at visual position row (or -1 to append). The board performs the undoable move.