Exemple #1
0
void TodoNote::taskChanged(const QModelIndex& proxy_index)
{
	extra_widget->setVisible(proxy_index.isValid());
	if(!proxy_index.isValid()) return;
	mapper->setRootIndex(proxy_index.parent());
	mapper->setCurrentModelIndex(proxy_index);
	QModelIndex index = proxy_model->mapToSource(proxy_index);
	Task* task = static_cast<Task*>(index.internalPointer());
	//
	disconnect(dt_date_limit, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(noteDateLimitChanged(QDateTime)));
	disconnect(cb_date_limit, SIGNAL(toggled(bool)), this, SLOT(noteLimitChanged(bool)));
	dt_date_limit->setDateTime(task->dateLimit());
	cb_date_limit->setChecked(task->limited());
	connect(dt_date_limit, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(noteDateLimitChanged(QDateTime)));
	connect(cb_date_limit, SIGNAL(toggled(bool)), this, SLOT(noteLimitChanged(bool)));
	//
	bool task_done = task->done();
	lb_date_1->setVisible(task_done);
	lb_date_stop->setVisible(task_done);
	cb_date_limit->setHidden(task_done);
	dt_date_limit->setHidden(task_done);
	dt_date_limit->setEnabled(task->limited());

}