The final step to a complete CRUD of our tasks is to implement the completed task feature. We'll implement the following:
- Click on the checkbox to mark the task as completed
- Strike the task name
- Update the status label in MainWindow
The checkbox click-handling follows the same pattern as removed:
// In Task.h signals: void removed(Task* task); void statusChanged(Task* task); private slots: void checked(bool checked); // in Task.cpp Task::Task(const QString& name, QWidget *parent) : QWidget(parent), ui(new Ui::Task) { ... connect(ui->checkbox, &QCheckBox::toggled, this, &Task::checked); } ... void Task::checked(bool checked) { QFont font(ui->checkbox->font()); font.setStrikeOut(checked); ...