本文整理汇总了C++中Todo::setCompleted方法的典型用法代码示例。如果您正苦于以下问题:C++ Todo::setCompleted方法的具体用法?C++ Todo::setCompleted怎么用?C++ Todo::setCompleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Todo
的用法示例。
在下文中一共展示了Todo::setCompleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setNewPercentage
void KOTodoView::setNewPercentage( KOTodoViewItem *item, int percentage )
{
kdDebug(5850) << "KOTodoView::setNewPercentage( " << percentage << "), item = " << item << endl;
if ( !item || !mChanger ) return;
Todo *todo = item->todo();
if ( !todo ) return;
if ( !todo->isReadOnly () && mChanger->beginChange( todo ) ) {
Todo *oldTodo = todo->clone();
/* Old code to make sub-items's percentage related to this one's:
QListViewItem *myChild = firstChild();
KOTodoViewItem *item;
while( myChild ) {
item = static_cast<KOTodoViewItem*>(myChild);
item->stateChange(state);
myChild = myChild->nextSibling();
}*/
if ( percentage == 100 ) {
todo->setCompleted( QDateTime::currentDateTime() );
// If the todo does recur, it doesn't get set as completed. However, the
// item is still checked. Uncheck it again.
if ( !todo->isCompleted() ) item->setState( QCheckListItem::Off );
else todo->setPercentComplete( percentage );
} else {
todo->setCompleted( false );
todo->setPercentComplete( percentage );
}
item->construct();
if ( todo->doesRecur() && percentage == 100 )
mChanger->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED_WITH_RECURRENCE );
else
mChanger->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED );
mChanger->endChange( todo );
delete oldTodo;
} else {
item->construct();
kdDebug(5850) << "No active item, active item is read-only, or locking failed" << endl;
}
}